Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: chrome/browser/ui/app_list/arc/arc_app_test.h

Issue 2106663004: arc: Initial implemetation of Chrome sync for Arc packages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Wrap bridge state related method in unit_tests. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
(...skipping 25 matching lines...) Expand all
36 36
37 // 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.
38 class ArcAppTest { 38 class ArcAppTest {
39 public: 39 public:
40 ArcAppTest(); 40 ArcAppTest();
41 virtual ~ArcAppTest(); 41 virtual ~ArcAppTest();
42 42
43 void SetUp(Profile* profile); 43 void SetUp(Profile* profile);
44 void TearDown(); 44 void TearDown();
45 45
46 // Public methods to set bridge status for unit_tests.
47 void SetBridgeServiceReady();
48 void SetBridgeServiceStopped();
49 void ResetBridgeServiceReady();
50
46 static std::string GetAppId(const arc::mojom::AppInfo& app_info); 51 static std::string GetAppId(const arc::mojom::AppInfo& app_info);
47 static std::string GetAppId(const arc::mojom::ShortcutInfo& shortcut); 52 static std::string GetAppId(const arc::mojom::ShortcutInfo& shortcut);
48 53
49 const std::vector<arc::mojom::ArcPackageInfo>& fake_packages() const { 54 const std::vector<arc::mojom::ArcPackageInfo>& fake_packages() const {
50 return fake_packages_; 55 return fake_packages_;
51 } 56 }
52 57
53 void AddPackage(const arc::mojom::ArcPackageInfo& package); 58 void AddPackage(const arc::mojom::ArcPackageInfo& package);
54 59
55 void RemovePackage(const arc::mojom::ArcPackageInfo& package); 60 void RemovePackage(const arc::mojom::ArcPackageInfo& package);
(...skipping 14 matching lines...) Expand all
70 arc::FakeAppInstance* app_instance() { return app_instance_.get(); } 75 arc::FakeAppInstance* app_instance() { return app_instance_.get(); }
71 76
72 ArcAppListPrefs* arc_app_list_prefs() { return arc_app_list_pref_; } 77 ArcAppListPrefs* arc_app_list_prefs() { return arc_app_list_pref_; }
73 78
74 arc::ArcAuthService* arc_auth_service() { return auth_service_.get(); } 79 arc::ArcAuthService* arc_auth_service() { return auth_service_.get(); }
75 80
76 private: 81 private:
77 const user_manager::User* CreateUserAndLogin(); 82 const user_manager::User* CreateUserAndLogin();
78 bool FindPackage(const arc::mojom::ArcPackageInfo& package); 83 bool FindPackage(const arc::mojom::ArcPackageInfo& package);
79 84
85 // AppInstance is destoryed after bridge stops and InstanceHolder::
86 // CloseChannel(). Reset AppInstance to continue unit_tests.
87 void ResetAppInstance();
88
80 // Unowned pointer. 89 // Unowned pointer.
81 Profile* profile_ = nullptr; 90 Profile* profile_ = nullptr;
82 91
83 ArcAppListPrefs* arc_app_list_pref_ = nullptr; 92 ArcAppListPrefs* arc_app_list_pref_ = nullptr;
84 93
85 std::unique_ptr<arc::FakeArcBridgeService> bridge_service_; 94 std::unique_ptr<arc::FakeArcBridgeService> bridge_service_;
86 std::unique_ptr<arc::FakeAppInstance> app_instance_; 95 std::unique_ptr<arc::FakeAppInstance> app_instance_;
87 std::unique_ptr<arc::ArcAuthService> auth_service_; 96 std::unique_ptr<arc::ArcAuthService> auth_service_;
88 std::unique_ptr<chromeos::ScopedUserManagerEnabler> user_manager_enabler_; 97 std::unique_ptr<chromeos::ScopedUserManagerEnabler> user_manager_enabler_;
89 std::vector<arc::mojom::AppInfo> fake_apps_; 98 std::vector<arc::mojom::AppInfo> fake_apps_;
90 std::vector<arc::mojom::ArcPackageInfo> fake_packages_; 99 std::vector<arc::mojom::ArcPackageInfo> fake_packages_;
91 std::vector<arc::mojom::ShortcutInfo> fake_shortcuts_; 100 std::vector<arc::mojom::ShortcutInfo> fake_shortcuts_;
92 101
93 DISALLOW_COPY_AND_ASSIGN(ArcAppTest); 102 DISALLOW_COPY_AND_ASSIGN(ArcAppTest);
94 }; 103 };
95 104
96 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_TEST_H_ 105 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698