OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_TEST_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_TEST_H_ |
6 #define CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_TEST_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_TEST_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "components/arc/common/app.mojom.h" | 13 #include "components/arc/common/app.mojom.h" |
14 | 14 |
15 namespace arc { | 15 namespace arc { |
16 namespace mojom { | 16 namespace mojom { |
17 class AppInfo; | 17 class AppInfo; |
18 class ArcPackageInfo; | 18 class ArcPackageInfo; |
19 } | 19 } |
20 class ArcAuthService; | 20 class ArcAuthService; |
21 class FakeArcBridgeService; | 21 class FakeArcBridgeService; |
22 class FakeAppInstance; | 22 class FakeAppInstance; |
23 } | 23 } |
24 | 24 |
25 namespace chromeos { | 25 namespace chromeos { |
26 class FakeChromeUserManager; | 26 class FakeChromeUserManager; |
27 class ScopedUserManagerEnabler; | 27 class ScopedUserManagerEnabler; |
28 } | 28 } |
29 | 29 |
| 30 namespace user_manager { |
| 31 class User; |
| 32 } |
| 33 |
30 class ArcAppListPrefs; | 34 class ArcAppListPrefs; |
31 class Profile; | 35 class Profile; |
32 | 36 |
33 // Helper class to initialize arc bridge to work with arc apps in unit tests. | 37 // Helper class to initialize arc bridge to work with arc apps in unit tests. |
34 class ArcAppTest { | 38 class ArcAppTest { |
35 public: | 39 public: |
36 ArcAppTest(); | 40 ArcAppTest(); |
37 virtual ~ArcAppTest(); | 41 virtual ~ArcAppTest(); |
38 | 42 |
39 void SetUp(Profile* profile); | 43 void SetUp(Profile* profile); |
(...skipping 23 matching lines...) Expand all Loading... |
63 | 67 |
64 arc::FakeArcBridgeService* bridge_service() { return bridge_service_.get(); } | 68 arc::FakeArcBridgeService* bridge_service() { return bridge_service_.get(); } |
65 | 69 |
66 arc::FakeAppInstance* app_instance() { return app_instance_.get(); } | 70 arc::FakeAppInstance* app_instance() { return app_instance_.get(); } |
67 | 71 |
68 ArcAppListPrefs* arc_app_list_prefs() { return arc_app_list_pref_; } | 72 ArcAppListPrefs* arc_app_list_prefs() { return arc_app_list_pref_; } |
69 | 73 |
70 arc::ArcAuthService* arc_auth_service() { return auth_service_.get(); } | 74 arc::ArcAuthService* arc_auth_service() { return auth_service_.get(); } |
71 | 75 |
72 private: | 76 private: |
73 void CreateUserAndLogin(); | 77 const user_manager::User* CreateUserAndLogin(); |
74 bool FindPackage(const arc::mojom::ArcPackageInfo& package); | 78 bool FindPackage(const arc::mojom::ArcPackageInfo& package); |
75 | 79 |
76 // Unowned pointer. | 80 // Unowned pointer. |
77 Profile* profile_ = nullptr; | 81 Profile* profile_ = nullptr; |
78 | 82 |
79 ArcAppListPrefs* arc_app_list_pref_ = nullptr; | 83 ArcAppListPrefs* arc_app_list_pref_ = nullptr; |
80 | 84 |
81 std::unique_ptr<arc::FakeArcBridgeService> bridge_service_; | 85 std::unique_ptr<arc::FakeArcBridgeService> bridge_service_; |
82 std::unique_ptr<arc::FakeAppInstance> app_instance_; | 86 std::unique_ptr<arc::FakeAppInstance> app_instance_; |
83 std::unique_ptr<arc::ArcAuthService> auth_service_; | 87 std::unique_ptr<arc::ArcAuthService> auth_service_; |
84 std::unique_ptr<chromeos::ScopedUserManagerEnabler> user_manager_enabler_; | 88 std::unique_ptr<chromeos::ScopedUserManagerEnabler> user_manager_enabler_; |
85 std::vector<arc::mojom::AppInfo> fake_apps_; | 89 std::vector<arc::mojom::AppInfo> fake_apps_; |
86 std::vector<arc::mojom::ArcPackageInfo> fake_packages_; | 90 std::vector<arc::mojom::ArcPackageInfo> fake_packages_; |
87 std::vector<arc::mojom::ShortcutInfo> fake_shortcuts_; | 91 std::vector<arc::mojom::ShortcutInfo> fake_shortcuts_; |
88 | 92 |
89 DISALLOW_COPY_AND_ASSIGN(ArcAppTest); | 93 DISALLOW_COPY_AND_ASSIGN(ArcAppTest); |
90 }; | 94 }; |
91 | 95 |
92 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_TEST_H_ | 96 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_TEST_H_ |
OLD | NEW |