1 // Copyright 2019 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_ANSIBLE_ANSIBLE_MANAGEMENT_TEST_HELPER_H_
6 #define CHROME_BROWSER_CHROMEOS_CROSTINI_ANSIBLE_ANSIBLE_MANAGEMENT_TEST_HELPER_H_
7 
8 #include "base/test/scoped_feature_list.h"
9 #include "chromeos/dbus/cicerone/cicerone_service.pb.h"
10 #include "chromeos/dbus/fake_cicerone_client.h"
11 
12 class Profile;
13 
14 namespace crostini {
15 
16 // Helper class that provides common Ansible setup functionality for Crostini
17 // tests that involve Ansible management. Test helper assumes that
18 // DBusThreadManager is already initialized and Crostini is enabled.
19 class AnsibleManagementTestHelper {
20  public:
21   explicit AnsibleManagementTestHelper(Profile* profile);
22 
23   void SetUpAnsiblePlaybookPreference();
24   void SetUpAnsibleInfra();
25 
26   void SetUpAnsibleInstallation(
27       vm_tools::cicerone::InstallLinuxPackageResponse::Status status);
28   void SetUpPlaybookApplication(
29       vm_tools::cicerone::ApplyAnsiblePlaybookResponse::Status status);
30   void SendSucceededInstallSignal();
31   void SendSucceededApplySignal();
32 
33  private:
34   Profile* profile_;
35   base::test::ScopedFeatureList scoped_feature_list_;
36 
37   // Owned by chromeos::DBusThreadManager
38   chromeos::FakeCiceroneClient* fake_cicerone_client_;
39 };
40 
41 }  // namespace crostini
42 
43 #endif  // CHROME_BROWSER_CHROMEOS_CROSTINI_ANSIBLE_ANSIBLE_MANAGEMENT_TEST_HELPER_H_
44