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

Side by Side Diff: chrome/browser/ui/ash/launcher/arc_app_launcher_browsertest.cc

Issue 2507073002: Split ArcSessionManager from ArcAuthService. (Closed)
Patch Set: Split ArcSessionManager from ArcAuthService Created 4 years, 1 month 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 #include "ash/common/shelf/shelf_delegate.h" 5 #include "ash/common/shelf/shelf_delegate.h"
6 #include "ash/common/wm_shell.h" 6 #include "ash/common/wm_shell.h"
7 #include "ash/wm/window_util.h" 7 #include "ash/wm/window_util.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "chrome/browser/extensions/extension_browsertest.h" 10 #include "chrome/browser/extensions/extension_browsertest.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 protected: 130 protected:
131 // content::BrowserTestBase: 131 // content::BrowserTestBase:
132 void SetUpCommandLine(base::CommandLine* command_line) override { 132 void SetUpCommandLine(base::CommandLine* command_line) override {
133 ExtensionBrowserTest::SetUpCommandLine(command_line); 133 ExtensionBrowserTest::SetUpCommandLine(command_line);
134 command_line->AppendSwitch(chromeos::switches::kEnableArc); 134 command_line->AppendSwitch(chromeos::switches::kEnableArc);
135 } 135 }
136 136
137 void SetUpInProcessBrowserTestFixture() override { 137 void SetUpInProcessBrowserTestFixture() override {
138 ExtensionBrowserTest::SetUpInProcessBrowserTestFixture(); 138 ExtensionBrowserTest::SetUpInProcessBrowserTestFixture();
139 arc::ArcAuthService::DisableUIForTesting(); 139 arc::ArcSessionManager::DisableUIForTesting();
140 } 140 }
141 141
142 void SetUpOnMainThread() override { arc::ArcAuthService::Get()->EnableArc(); } 142 void SetUpOnMainThread() override {
143 arc::ArcSessionManager::Get()->EnableArc();
144 }
143 145
144 void InstallTestApps(bool multi_app) { 146 void InstallTestApps(bool multi_app) {
145 app_host()->OnAppListRefreshed(GetTestAppsList(multi_app)); 147 app_host()->OnAppListRefreshed(GetTestAppsList(multi_app));
146 148
147 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = 149 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info =
148 app_prefs()->GetApp(GetTestApp1Id()); 150 app_prefs()->GetApp(GetTestApp1Id());
149 ASSERT_TRUE(app_info); 151 ASSERT_TRUE(app_info);
150 EXPECT_TRUE(app_info->ready); 152 EXPECT_TRUE(app_info->ready);
151 if (multi_app) { 153 if (multi_app) {
152 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info2 = 154 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info2 =
(...skipping 17 matching lines...) Expand all
170 } 172 }
171 173
172 void SendPackageUpdated(bool multi_app) { 174 void SendPackageUpdated(bool multi_app) {
173 app_host()->OnPackageAppListRefreshed(kTestAppPackage, 175 app_host()->OnPackageAppListRefreshed(kTestAppPackage,
174 GetTestAppsList(multi_app)); 176 GetTestAppsList(multi_app));
175 } 177 }
176 178
177 void SendPackageRemoved() { app_host()->OnPackageRemoved(kTestAppPackage); } 179 void SendPackageRemoved() { app_host()->OnPackageRemoved(kTestAppPackage); }
178 180
179 void StartInstance() { 181 void StartInstance() {
180 if (auth_service()->profile() != profile()) 182 if (arc_session_manager()->profile() != profile())
181 auth_service()->OnPrimaryUserProfilePrepared(profile()); 183 arc_session_manager()->OnPrimaryUserProfilePrepared(profile());
182 app_instance_observer()->OnInstanceReady(); 184 app_instance_observer()->OnInstanceReady();
183 } 185 }
184 186
185 void StopInstance() { 187 void StopInstance() {
186 auth_service()->Shutdown(); 188 arc_session_manager()->Shutdown();
187 app_instance_observer()->OnInstanceClosed(); 189 app_instance_observer()->OnInstanceClosed();
188 } 190 }
189 191
190 ArcAppListPrefs* app_prefs() { return ArcAppListPrefs::Get(profile()); } 192 ArcAppListPrefs* app_prefs() { return ArcAppListPrefs::Get(profile()); }
191 193
192 // Returns as AppHost interface in order to access to private implementation 194 // Returns as AppHost interface in order to access to private implementation
193 // of the interface. 195 // of the interface.
194 arc::mojom::AppHost* app_host() { return app_prefs(); } 196 arc::mojom::AppHost* app_host() { return app_prefs(); }
195 197
196 // Returns as AppInstance observer interface in order to access to private 198 // Returns as AppInstance observer interface in order to access to private
197 // implementation of the interface. 199 // implementation of the interface.
198 arc::InstanceHolder<arc::mojom::AppInstance>::Observer* 200 arc::InstanceHolder<arc::mojom::AppInstance>::Observer*
199 app_instance_observer() { 201 app_instance_observer() {
200 return app_prefs(); 202 return app_prefs();
201 } 203 }
202 204
203 arc::ArcAuthService* auth_service() { return arc::ArcAuthService::Get(); } 205 arc::ArcSessionManager* arc_session_manager() {
206 return arc::ArcSessionManager::Get();
207 }
204 208
205 private: 209 private:
206 DISALLOW_COPY_AND_ASSIGN(ArcAppLauncherBrowserTest); 210 DISALLOW_COPY_AND_ASSIGN(ArcAppLauncherBrowserTest);
207 }; 211 };
208 212
209 class ArcAppDeferredLauncherBrowserTest 213 class ArcAppDeferredLauncherBrowserTest
210 : public ArcAppLauncherBrowserTest, 214 : public ArcAppLauncherBrowserTest,
211 public testing::WithParamInterface<TestParameter> { 215 public testing::WithParamInterface<TestParameter> {
212 public: 216 public:
213 ArcAppDeferredLauncherBrowserTest() {} 217 ArcAppDeferredLauncherBrowserTest() {}
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 AppListService* service = AppListService::Get(); 376 AppListService* service = AppListService::Get();
373 AppListControllerDelegate* delegate = service->GetControllerDelegate(); 377 AppListControllerDelegate* delegate = service->GetControllerDelegate();
374 EXPECT_FALSE(delegate->IsAppOpen(app_id)); 378 EXPECT_FALSE(delegate->IsAppOpen(app_id));
375 arc::LaunchApp(profile(), app_id); 379 arc::LaunchApp(profile(), app_id);
376 EXPECT_FALSE(delegate->IsAppOpen(app_id)); 380 EXPECT_FALSE(delegate->IsAppOpen(app_id));
377 // Simulate task creation so the app is marked as running/open. 381 // Simulate task creation so the app is marked as running/open.
378 std::unique_ptr<ArcAppListPrefs::AppInfo> info = app_prefs()->GetApp(app_id); 382 std::unique_ptr<ArcAppListPrefs::AppInfo> info = app_prefs()->GetApp(app_id);
379 app_host()->OnTaskCreated(0, info->package_name, info->activity, info->name); 383 app_host()->OnTaskCreated(0, info->package_name, info->activity, info->name);
380 EXPECT_TRUE(delegate->IsAppOpen(app_id)); 384 EXPECT_TRUE(delegate->IsAppOpen(app_id));
381 } 385 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698