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

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

Issue 2601323002: arc: Handle default app not availble case. (Closed)
Patch Set: Created 3 years, 11 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 #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 "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 220
221 void SendPackageUpdated(const std::string& package_name, bool multi_app) { 221 void SendPackageUpdated(const std::string& package_name, bool multi_app) {
222 app_host()->OnPackageAppListRefreshed( 222 app_host()->OnPackageAppListRefreshed(
223 package_name, GetTestAppsList(package_name, multi_app)); 223 package_name, GetTestAppsList(package_name, multi_app));
224 } 224 }
225 225
226 void SendPackageRemoved(const std::string& package_name) { 226 void SendPackageRemoved(const std::string& package_name) {
227 app_host()->OnPackageRemoved(package_name); 227 app_host()->OnPackageRemoved(package_name);
228 } 228 }
229 229
230 void SendInstallationStarted() { 230 void SendInstallationStarted(const std::string& package_name) {
231 app_host()->OnInstallationStarted(); 231 app_host()->OnInstallationStarted(package_name);
232 base::RunLoop().RunUntilIdle(); 232 base::RunLoop().RunUntilIdle();
233 } 233 }
234 234
235 void SendInstallationFinished() { 235 void SendInstallationFinished(const std::string& package_name, bool success) {
236 app_host()->OnInstallationFinished(); 236 app_host()->OnInstallationFinished(package_name, success);
237 base::RunLoop().RunUntilIdle(); 237 base::RunLoop().RunUntilIdle();
238 } 238 }
239 239
240 void StartInstance() { 240 void StartInstance() {
241 if (arc_session_manager()->profile() != profile()) 241 if (arc_session_manager()->profile() != profile())
242 arc_session_manager()->OnPrimaryUserProfilePrepared(profile()); 242 arc_session_manager()->OnPrimaryUserProfilePrepared(profile());
243 app_instance_observer()->OnInstanceReady(); 243 app_instance_observer()->OnInstanceReady();
244 } 244 }
245 245
246 void StopInstance() { 246 void StopInstance() {
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 410
411 // This test validates that app list is shown on new package and not shown 411 // This test validates that app list is shown on new package and not shown
412 // on package update. 412 // on package update.
413 IN_PROC_BROWSER_TEST_F(ArcAppLauncherBrowserTest, AppListShown) { 413 IN_PROC_BROWSER_TEST_F(ArcAppLauncherBrowserTest, AppListShown) {
414 StartInstance(); 414 StartInstance();
415 AppListService* app_list_service = AppListService::Get(); 415 AppListService* app_list_service = AppListService::Get();
416 ASSERT_TRUE(app_list_service); 416 ASSERT_TRUE(app_list_service);
417 417
418 EXPECT_FALSE(app_list_service->IsAppListVisible()); 418 EXPECT_FALSE(app_list_service->IsAppListVisible());
419 419
420 SendInstallationStarted(); 420 SendInstallationStarted(kTestAppPackage);
421 SendInstallationStarted(); 421 SendInstallationStarted(kTestAppPackage2);
422 422
423 // New package is available. Show app list. 423 // New package is available. Show app list.
424 SendInstallationFinished(); 424 SendInstallationFinished(kTestAppPackage, true);
425 InstallTestApps(kTestAppPackage, false); 425 InstallTestApps(kTestAppPackage, false);
426 SendPackageAdded(kTestAppPackage, true); 426 SendPackageAdded(kTestAppPackage, true);
427 EXPECT_TRUE(app_list_service->IsAppListVisible()); 427 EXPECT_TRUE(app_list_service->IsAppListVisible());
428 428
429 app_list_service->DismissAppList(); 429 app_list_service->DismissAppList();
430 EXPECT_FALSE(app_list_service->IsAppListVisible()); 430 EXPECT_FALSE(app_list_service->IsAppListVisible());
431 431
432 // Send package update event. App list is not shown. 432 // Send package update event. App list is not shown.
433 SendPackageAdded(kTestAppPackage, true); 433 SendPackageAdded(kTestAppPackage, true);
434 EXPECT_FALSE(app_list_service->IsAppListVisible()); 434 EXPECT_FALSE(app_list_service->IsAppListVisible());
435 435
436 // Install next package from batch. Next new package is available. 436 // Install next package from batch. Next new package is available.
437 // Don't show app list. 437 // Don't show app list.
438 SendInstallationFinished(); 438 SendInstallationFinished(kTestAppPackage2, true);
439 InstallTestApps(kTestAppPackage2, false); 439 InstallTestApps(kTestAppPackage2, false);
440 SendPackageAdded(kTestAppPackage2, true); 440 SendPackageAdded(kTestAppPackage2, true);
441 EXPECT_FALSE(app_list_service->IsAppListVisible()); 441 EXPECT_FALSE(app_list_service->IsAppListVisible());
442 442
443 // Run next installation batch. App list should be shown again. 443 // Run next installation batch. App list should be shown again.
444 SendInstallationStarted(); 444 SendInstallationStarted(kTestAppPackage3);
445 SendInstallationFinished(); 445 SendInstallationFinished(kTestAppPackage3, true);
446 InstallTestApps(kTestAppPackage3, false); 446 InstallTestApps(kTestAppPackage3, false);
447 SendPackageAdded(kTestAppPackage3, true); 447 SendPackageAdded(kTestAppPackage3, true);
448 EXPECT_TRUE(app_list_service->IsAppListVisible()); 448 EXPECT_TRUE(app_list_service->IsAppListVisible());
449 app_list_service->DismissAppList(); 449 app_list_service->DismissAppList();
450 } 450 }
451 451
452 // Test AppListControllerDelegate::IsAppOpen for Arc apps. 452 // Test AppListControllerDelegate::IsAppOpen for Arc apps.
453 IN_PROC_BROWSER_TEST_F(ArcAppLauncherBrowserTest, IsAppOpen) { 453 IN_PROC_BROWSER_TEST_F(ArcAppLauncherBrowserTest, IsAppOpen) {
454 StartInstance(); 454 StartInstance();
455 InstallTestApps(kTestAppPackage, false); 455 InstallTestApps(kTestAppPackage, false);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 app_host()->OnTaskDestroyed(2); 531 app_host()->OnTaskDestroyed(2);
532 EXPECT_EQ(controller2, GetAppItemController(shelf_id2)); 532 EXPECT_EQ(controller2, GetAppItemController(shelf_id2));
533 // Destroy task #2, this kills shelf group 2 533 // Destroy task #2, this kills shelf group 2
534 app_host()->OnTaskDestroyed(3); 534 app_host()->OnTaskDestroyed(3);
535 EXPECT_FALSE(GetAppItemController(shelf_id2)); 535 EXPECT_FALSE(GetAppItemController(shelf_id2));
536 536
537 // Disable Arc, this removes app and as result kills shelf group 3. 537 // Disable Arc, this removes app and as result kills shelf group 3.
538 arc::ArcSessionManager::Get()->DisableArc(); 538 arc::ArcSessionManager::Get()->DisableArc();
539 EXPECT_FALSE(GetAppItemController(shelf_id3)); 539 EXPECT_FALSE(GetAppItemController(shelf_id3));
540 } 540 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698