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

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

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

Powered by Google App Engine
This is Rietveld 408576698