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

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

Issue 1823923002: arc: Support running Arc app in shelf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased + few nits Created 4 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 11 matching lines...) Expand all
22 #include "base/files/file_path.h" 22 #include "base/files/file_path.h"
23 #include "base/macros.h" 23 #include "base/macros.h"
24 #include "base/memory/scoped_ptr.h" 24 #include "base/memory/scoped_ptr.h"
25 #include "base/message_loop/message_loop.h" 25 #include "base/message_loop/message_loop.h"
26 #include "base/strings/utf_string_conversions.h" 26 #include "base/strings/utf_string_conversions.h"
27 #include "base/values.h" 27 #include "base/values.h"
28 #include "build/build_config.h" 28 #include "build/build_config.h"
29 #include "chrome/browser/extensions/extension_service.h" 29 #include "chrome/browser/extensions/extension_service.h"
30 #include "chrome/browser/extensions/test_extension_system.h" 30 #include "chrome/browser/extensions/test_extension_system.h"
31 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" 31 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h"
32 #include "chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.h" 32 #include "chrome/browser/ui/ash/launcher/extension_app_window_launcher_item_cont roller.h"
33 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" 33 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h"
34 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" 34 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h"
35 #include "chrome/browser/ui/browser.h" 35 #include "chrome/browser/ui/browser.h"
36 #include "chrome/browser/ui/browser_commands.h" 36 #include "chrome/browser/ui/browser_commands.h"
37 #include "chrome/browser/ui/browser_finder.h" 37 #include "chrome/browser/ui/browser_finder.h"
38 #include "chrome/browser/ui/browser_list.h" 38 #include "chrome/browser/ui/browser_list.h"
39 #include "chrome/browser/ui/browser_tabstrip.h" 39 #include "chrome/browser/ui/browser_tabstrip.h"
40 #include "chrome/browser/ui/tabs/tab_strip_model.h" 40 #include "chrome/browser/ui/tabs/tab_strip_model.h"
41 #include "chrome/common/extensions/extension_constants.h" 41 #include "chrome/common/extensions/extension_constants.h"
42 #include "chrome/common/pref_names.h" 42 #include "chrome/common/pref_names.h"
43 #include "chrome/test/base/browser_with_test_window_test.h" 43 #include "chrome/test/base/browser_with_test_window_test.h"
44 #include "chrome/test/base/testing_profile.h" 44 #include "chrome/test/base/testing_profile.h"
45 #include "components/signin/core/account_id/account_id.h" 45 #include "components/signin/core/account_id/account_id.h"
46 #include "components/syncable_prefs/testing_pref_service_syncable.h" 46 #include "components/syncable_prefs/testing_pref_service_syncable.h"
47 #include "content/public/browser/web_contents.h" 47 #include "content/public/browser/web_contents.h"
48 #include "extensions/common/extension.h" 48 #include "extensions/common/extension.h"
49 #include "extensions/common/manifest_constants.h" 49 #include "extensions/common/manifest_constants.h"
50 #include "testing/gtest/include/gtest/gtest.h" 50 #include "testing/gtest/include/gtest/gtest.h"
51 #include "ui/aura/client/window_tree_client.h" 51 #include "ui/aura/client/window_tree_client.h"
52 #include "ui/base/models/menu_model.h" 52 #include "ui/base/models/menu_model.h"
53 #include "ui/views/widget/widget.h"
53 54
54 #if defined(OS_CHROMEOS) 55 #if defined(OS_CHROMEOS)
55 #include "ash/test/test_session_state_delegate.h" 56 #include "ash/test/test_session_state_delegate.h"
56 #include "ash/test/test_shell_delegate.h" 57 #include "ash/test/test_shell_delegate.h"
57 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" 58 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
58 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 59 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
59 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" 60 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
60 #include "chrome/browser/lifetime/scoped_keep_alive.h" 61 #include "chrome/browser/lifetime/scoped_keep_alive.h"
61 #include "chrome/browser/ui/apps/chrome_app_delegate.h" 62 #include "chrome/browser/ui/apps/chrome_app_delegate.h"
62 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h" 63 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h"
63 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" 64 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h"
64 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" 65 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
65 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" 66 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
66 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" 67 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h"
67 #include "chrome/common/chrome_constants.h" 68 #include "chrome/common/chrome_constants.h"
68 #include "chrome/common/chrome_switches.h" 69 #include "chrome/common/chrome_switches.h"
69 #include "chrome/test/base/testing_browser_process.h" 70 #include "chrome/test/base/testing_browser_process.h"
70 #include "chrome/test/base/testing_profile_manager.h" 71 #include "chrome/test/base/testing_profile_manager.h"
72 #include "components/exo/shell_surface.h"
71 #include "components/user_manager/fake_user_manager.h" 73 #include "components/user_manager/fake_user_manager.h"
72 #include "content/public/browser/web_contents_observer.h" 74 #include "content/public/browser/web_contents_observer.h"
73 #include "content/public/test/test_utils.h" 75 #include "content/public/test/test_utils.h"
74 #include "content/public/test/web_contents_tester.h" 76 #include "content/public/test/web_contents_tester.h"
75 #include "extensions/browser/app_window/app_window_contents.h" 77 #include "extensions/browser/app_window/app_window_contents.h"
76 #include "extensions/browser/app_window/app_window_registry.h" 78 #include "extensions/browser/app_window/app_window_registry.h"
77 #include "extensions/browser/app_window/native_app_window.h" 79 #include "extensions/browser/app_window/native_app_window.h"
78 #include "ui/aura/window.h" 80 #include "ui/aura/window.h"
79 #endif 81 #endif
80 82
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 #if defined(OS_CHROMEOS) 652 #if defined(OS_CHROMEOS)
651 void InstallArcApps() { 653 void InstallArcApps() {
652 arc_test_.app_instance()->RefreshAppList(); 654 arc_test_.app_instance()->RefreshAppList();
653 arc_test_.app_instance()->SendRefreshAppList(arc_test_.fake_apps()); 655 arc_test_.app_instance()->SendRefreshAppList(arc_test_.fake_apps());
654 } 656 }
655 657
656 void UninstallArcApps() { 658 void UninstallArcApps() {
657 arc_test_.app_instance()->RefreshAppList(); 659 arc_test_.app_instance()->RefreshAppList();
658 arc_test_.app_instance()->SendRefreshAppList(std::vector<arc::AppInfo>()); 660 arc_test_.app_instance()->SendRefreshAppList(std::vector<arc::AppInfo>());
659 } 661 }
662
663 // Creates app window and set optional Arc application id.
664 views::Widget* CreateAppWindow(std::string* window_app_id) {
665 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
666 params.bounds = gfx::Rect(5, 5, 20, 20);
667 views::Widget* widget = new views::Widget();
668 widget->Init(params);
669 widget->Show();
670 widget->Activate();
671 if (window_app_id) {
672 exo::ShellSurface::SetApplicationId(widget->GetNativeWindow(),
673 window_app_id);
674 }
675 return widget;
676 }
677
660 #endif // defined(OS_CHROMEOS) 678 #endif // defined(OS_CHROMEOS)
661 679
662 // Needed for extension service & friends to work. 680 // Needed for extension service & friends to work.
663 scoped_refptr<Extension> extension1_; 681 scoped_refptr<Extension> extension1_;
664 scoped_refptr<Extension> extension2_; 682 scoped_refptr<Extension> extension2_;
665 scoped_refptr<Extension> extension3_; 683 scoped_refptr<Extension> extension3_;
666 scoped_refptr<Extension> extension4_; 684 scoped_refptr<Extension> extension4_;
667 scoped_refptr<Extension> extension5_; 685 scoped_refptr<Extension> extension5_;
668 scoped_refptr<Extension> extension6_; 686 scoped_refptr<Extension> extension6_;
669 scoped_refptr<Extension> extension7_; 687 scoped_refptr<Extension> extension7_;
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
1438 EXPECT_TRUE(launcher_controller_->IsAppPinned(arc_app_id)); 1456 EXPECT_TRUE(launcher_controller_->IsAppPinned(arc_app_id));
1439 EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id())); 1457 EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id()));
1440 1458
1441 EXPECT_EQ("AppList, Chrome, App1, Fake App 0, App2", GetPinnedAppStatus()); 1459 EXPECT_EQ("AppList, Chrome, App1, Fake App 0, App2", GetPinnedAppStatus());
1442 UninstallArcApps(); 1460 UninstallArcApps();
1443 EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus()); 1461 EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus());
1444 InstallArcApps(); 1462 InstallArcApps();
1445 EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus()); 1463 EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus());
1446 } 1464 }
1447 1465
1466 TEST_F(ChromeLauncherControllerTest, ArcAppShelf) {
1467 InitLauncherController();
1468
1469 const arc::AppInfo& app_info = arc_test_.fake_apps()[0];
1470 const std::string arc_app_id = ArcAppTest::GetAppId(app_info);
1471
1472 InstallArcApps();
1473
1474 EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id));
1475 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id));
1476
1477 arc_test_.app_instance()->SetTaskInfo(100, app_info.package_name,
1478 app_info.activity);
1479
1480 std::string win_app_id = "org.chromium.arc.100";
1481 views::Widget* arc_app_window = CreateAppWindow(&win_app_id);
1482
1483 // Item is not created until bridge returns task information.
1484 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id));
1485 EXPECT_EQ(2, model_->item_count());
1486
1487 arc_test_.app_instance()->WaitForIncomingMethodCall();
1488 content::BrowserThread::GetBlockingPool()->FlushForTesting();
1489 base::RunLoop().RunUntilIdle();
1490
1491 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id));
1492 ASSERT_EQ(3, model_->item_count());
1493 // Activation notification does not properly works in unit_tests.
1494 EXPECT_TRUE(model_->items().back().status == ash::STATUS_RUNNING ||
1495 model_->items().back().status == ash::STATUS_ACTIVE);
1496
1497 // Destroying window removes shelf item.
1498 arc_app_window->CloseNow();
1499 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id));
1500 EXPECT_EQ(2, model_->item_count());
1501
1502 // Test with pinned app.
1503 launcher_controller_->PinAppWithID(arc_app_id);
1504 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id));
1505 ASSERT_EQ(3, model_->item_count());
1506 EXPECT_EQ(ash::STATUS_CLOSED, model_->items().back().status);
1507
1508 // Run Arc task and status should change.
1509 arc_app_window = CreateAppWindow(&win_app_id);
1510 arc_test_.app_instance()->WaitForIncomingMethodCall();
1511 content::BrowserThread::GetBlockingPool()->FlushForTesting();
1512 base::RunLoop().RunUntilIdle();
1513
1514 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id));
1515 ASSERT_EQ(3, model_->item_count());
1516 EXPECT_TRUE(model_->items().back().status == ash::STATUS_RUNNING ||
1517 model_->items().back().status == ash::STATUS_ACTIVE);
1518
1519 // Close Arc task and status should change back to ash::STATUS_CLOSED.
1520 arc_app_window->CloseNow();
1521 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id));
1522 ASSERT_EQ(3, model_->item_count());
1523 EXPECT_EQ(ash::STATUS_CLOSED, model_->items().back().status);
1524 }
1525
1448 // Check that with multi profile V1 apps are properly added / removed from the 1526 // Check that with multi profile V1 apps are properly added / removed from the
1449 // shelf. 1527 // shelf.
1450 TEST_F(MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest, 1528 TEST_F(MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest,
1451 V1AppUpdateOnUserSwitch) { 1529 V1AppUpdateOnUserSwitch) {
1452 // Create a browser item in the LauncherController. 1530 // Create a browser item in the LauncherController.
1453 InitLauncherController(); 1531 InitLauncherController();
1454 EXPECT_EQ(2, model_->item_count()); 1532 EXPECT_EQ(2, model_->item_count());
1455 { 1533 {
1456 // Create a "windowed gmail app". 1534 // Create a "windowed gmail app".
1457 scoped_ptr<V1App> v1_app(CreateRunningV1App( 1535 scoped_ptr<V1App> v1_app(CreateRunningV1App(
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after
2617 EXPECT_EQ(2, model_observer_->added()); 2695 EXPECT_EQ(2, model_observer_->added());
2618 2696
2619 const std::string app_id = extension1_->id(); 2697 const std::string app_id = extension1_->id();
2620 // app_icon_loader is owned by ChromeLauncherController. 2698 // app_icon_loader is owned by ChromeLauncherController.
2621 TestAppIconLoaderImpl* app_icon_loader = new TestAppIconLoaderImpl(); 2699 TestAppIconLoaderImpl* app_icon_loader = new TestAppIconLoaderImpl();
2622 app_icon_loader->AddSupportedApp(app_id); 2700 app_icon_loader->AddSupportedApp(app_id);
2623 SetAppIconLoader(scoped_ptr<AppIconLoader>(app_icon_loader)); 2701 SetAppIconLoader(scoped_ptr<AppIconLoader>(app_icon_loader));
2624 2702
2625 // Test adding an app panel 2703 // Test adding an app panel
2626 AppWindowLauncherItemController* app_panel_controller = 2704 AppWindowLauncherItemController* app_panel_controller =
2627 new AppWindowLauncherItemController( 2705 new ExtensionAppWindowLauncherItemController(
2628 LauncherItemController::TYPE_APP_PANEL, 2706 LauncherItemController::TYPE_APP_PANEL, "id", app_id,
2629 "id",
2630 app_id,
2631 launcher_controller_.get()); 2707 launcher_controller_.get());
2632 ash::ShelfID shelf_id1 = launcher_controller_->CreateAppLauncherItem( 2708 ash::ShelfID shelf_id1 = launcher_controller_->CreateAppLauncherItem(
2633 app_panel_controller, app_id, ash::STATUS_RUNNING); 2709 app_panel_controller, app_id, ash::STATUS_RUNNING);
2634 int panel_index = model_observer_->last_index(); 2710 int panel_index = model_observer_->last_index();
2635 EXPECT_EQ(3, model_observer_->added()); 2711 EXPECT_EQ(3, model_observer_->added());
2636 EXPECT_EQ(0, model_observer_->changed()); 2712 EXPECT_EQ(0, model_observer_->changed());
2637 EXPECT_EQ(1, app_icon_loader->fetch_count()); 2713 EXPECT_EQ(1, app_icon_loader->fetch_count());
2638 model_observer_->clear_counts(); 2714 model_observer_->clear_counts();
2639 2715
2640 // App panels should have a separate identifier than the app id 2716 // App panels should have a separate identifier than the app id
2641 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(app_id)); 2717 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(app_id));
2642 2718
2643 // Setting the app image image should not change the panel if it set its icon 2719 // Setting the app image image should not change the panel if it set its icon
2644 app_panel_controller->set_image_set_by_controller(true); 2720 app_panel_controller->set_image_set_by_controller(true);
2645 gfx::ImageSkia image; 2721 gfx::ImageSkia image;
2646 launcher_controller_->OnAppImageUpdated(app_id, image); 2722 launcher_controller_->OnAppImageUpdated(app_id, image);
2647 EXPECT_EQ(0, model_observer_->changed()); 2723 EXPECT_EQ(0, model_observer_->changed());
2648 model_observer_->clear_counts(); 2724 model_observer_->clear_counts();
2649 2725
2650 // Add a second app panel and verify that it get the same index as the first 2726 // Add a second app panel and verify that it get the same index as the first
2651 // one had, being added to the left of the existing panel. 2727 // one had, being added to the left of the existing panel.
2652 AppWindowLauncherItemController* app_panel_controller2 = 2728 AppWindowLauncherItemController* app_panel_controller2 =
2653 new AppWindowLauncherItemController( 2729 new ExtensionAppWindowLauncherItemController(
2654 LauncherItemController::TYPE_APP_PANEL, 2730 LauncherItemController::TYPE_APP_PANEL, "id", app_id,
2655 "id",
2656 app_id,
2657 launcher_controller_.get()); 2731 launcher_controller_.get());
2658 2732
2659 ash::ShelfID shelf_id2 = launcher_controller_->CreateAppLauncherItem( 2733 ash::ShelfID shelf_id2 = launcher_controller_->CreateAppLauncherItem(
2660 app_panel_controller2, app_id, ash::STATUS_RUNNING); 2734 app_panel_controller2, app_id, ash::STATUS_RUNNING);
2661 EXPECT_EQ(panel_index, model_observer_->last_index()); 2735 EXPECT_EQ(panel_index, model_observer_->last_index());
2662 EXPECT_EQ(1, model_observer_->added()); 2736 EXPECT_EQ(1, model_observer_->added());
2663 model_observer_->clear_counts(); 2737 model_observer_->clear_counts();
2664 2738
2665 launcher_controller_->CloseLauncherItem(shelf_id2); 2739 launcher_controller_->CloseLauncherItem(shelf_id2);
2666 launcher_controller_->CloseLauncherItem(shelf_id1); 2740 launcher_controller_->CloseLauncherItem(shelf_id1);
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
2864 // app_icon_loader1 and app_icon_loader2 are owned by 2938 // app_icon_loader1 and app_icon_loader2 are owned by
2865 // ChromeLauncherController. 2939 // ChromeLauncherController.
2866 TestAppIconLoaderImpl* app_icon_loader1 = new TestAppIconLoaderImpl(); 2940 TestAppIconLoaderImpl* app_icon_loader1 = new TestAppIconLoaderImpl();
2867 TestAppIconLoaderImpl* app_icon_loader2 = new TestAppIconLoaderImpl(); 2941 TestAppIconLoaderImpl* app_icon_loader2 = new TestAppIconLoaderImpl();
2868 app_icon_loader1->AddSupportedApp(app_id1); 2942 app_icon_loader1->AddSupportedApp(app_id1);
2869 app_icon_loader2->AddSupportedApp(app_id2); 2943 app_icon_loader2->AddSupportedApp(app_id2);
2870 SetAppIconLoaders(scoped_ptr<AppIconLoader>(app_icon_loader1), 2944 SetAppIconLoaders(scoped_ptr<AppIconLoader>(app_icon_loader1),
2871 scoped_ptr<AppIconLoader>(app_icon_loader2)); 2945 scoped_ptr<AppIconLoader>(app_icon_loader2));
2872 2946
2873 AppWindowLauncherItemController* app_panel_controller3 = 2947 AppWindowLauncherItemController* app_panel_controller3 =
2874 new AppWindowLauncherItemController( 2948 new ExtensionAppWindowLauncherItemController(
2875 LauncherItemController::TYPE_APP_PANEL, "id", app_id3, 2949 LauncherItemController::TYPE_APP_PANEL, "id", app_id3,
2876 launcher_controller_.get()); 2950 launcher_controller_.get());
2877 const ash::ShelfID shelfId3 = launcher_controller_->CreateAppLauncherItem( 2951 const ash::ShelfID shelfId3 = launcher_controller_->CreateAppLauncherItem(
2878 app_panel_controller3, app_id3, ash::STATUS_RUNNING); 2952 app_panel_controller3, app_id3, ash::STATUS_RUNNING);
2879 EXPECT_EQ(0, app_icon_loader1->fetch_count()); 2953 EXPECT_EQ(0, app_icon_loader1->fetch_count());
2880 EXPECT_EQ(0, app_icon_loader1->clear_count()); 2954 EXPECT_EQ(0, app_icon_loader1->clear_count());
2881 EXPECT_EQ(0, app_icon_loader2->fetch_count()); 2955 EXPECT_EQ(0, app_icon_loader2->fetch_count());
2882 EXPECT_EQ(0, app_icon_loader2->clear_count()); 2956 EXPECT_EQ(0, app_icon_loader2->clear_count());
2883 2957
2884 AppWindowLauncherItemController* app_panel_controller2 = 2958 AppWindowLauncherItemController* app_panel_controller2 =
2885 new AppWindowLauncherItemController( 2959 new ExtensionAppWindowLauncherItemController(
2886 LauncherItemController::TYPE_APP_PANEL, "id", app_id2, 2960 LauncherItemController::TYPE_APP_PANEL, "id", app_id2,
2887 launcher_controller_.get()); 2961 launcher_controller_.get());
2888 const ash::ShelfID shelfId2 = launcher_controller_->CreateAppLauncherItem( 2962 const ash::ShelfID shelfId2 = launcher_controller_->CreateAppLauncherItem(
2889 app_panel_controller2, app_id2, ash::STATUS_RUNNING); 2963 app_panel_controller2, app_id2, ash::STATUS_RUNNING);
2890 EXPECT_EQ(0, app_icon_loader1->fetch_count()); 2964 EXPECT_EQ(0, app_icon_loader1->fetch_count());
2891 EXPECT_EQ(0, app_icon_loader1->clear_count()); 2965 EXPECT_EQ(0, app_icon_loader1->clear_count());
2892 EXPECT_EQ(1, app_icon_loader2->fetch_count()); 2966 EXPECT_EQ(1, app_icon_loader2->fetch_count());
2893 EXPECT_EQ(0, app_icon_loader2->clear_count()); 2967 EXPECT_EQ(0, app_icon_loader2->clear_count());
2894 2968
2895 // Test adding an app panel 2969 // Test adding an app panel
2896 AppWindowLauncherItemController* app_panel_controller1 = 2970 AppWindowLauncherItemController* app_panel_controller1 =
2897 new AppWindowLauncherItemController( 2971 new ExtensionAppWindowLauncherItemController(
2898 LauncherItemController::TYPE_APP_PANEL, "id", app_id1, 2972 LauncherItemController::TYPE_APP_PANEL, "id", app_id1,
2899 launcher_controller_.get()); 2973 launcher_controller_.get());
2900 2974
2901 const ash::ShelfID shelfId1 = launcher_controller_->CreateAppLauncherItem( 2975 const ash::ShelfID shelfId1 = launcher_controller_->CreateAppLauncherItem(
2902 app_panel_controller1, app_id1, ash::STATUS_RUNNING); 2976 app_panel_controller1, app_id1, ash::STATUS_RUNNING);
2903 EXPECT_EQ(1, app_icon_loader1->fetch_count()); 2977 EXPECT_EQ(1, app_icon_loader1->fetch_count());
2904 EXPECT_EQ(0, app_icon_loader1->clear_count()); 2978 EXPECT_EQ(0, app_icon_loader1->clear_count());
2905 EXPECT_EQ(1, app_icon_loader2->fetch_count()); 2979 EXPECT_EQ(1, app_icon_loader2->fetch_count());
2906 EXPECT_EQ(0, app_icon_loader2->clear_count()); 2980 EXPECT_EQ(0, app_icon_loader2->clear_count());
2907 2981
2908 launcher_controller_->CloseLauncherItem(shelfId1); 2982 launcher_controller_->CloseLauncherItem(shelfId1);
2909 EXPECT_EQ(1, app_icon_loader1->fetch_count()); 2983 EXPECT_EQ(1, app_icon_loader1->fetch_count());
2910 EXPECT_EQ(1, app_icon_loader1->clear_count()); 2984 EXPECT_EQ(1, app_icon_loader1->clear_count());
2911 EXPECT_EQ(1, app_icon_loader2->fetch_count()); 2985 EXPECT_EQ(1, app_icon_loader2->fetch_count());
2912 EXPECT_EQ(0, app_icon_loader2->clear_count()); 2986 EXPECT_EQ(0, app_icon_loader2->clear_count());
2913 2987
2914 launcher_controller_->CloseLauncherItem(shelfId2); 2988 launcher_controller_->CloseLauncherItem(shelfId2);
2915 EXPECT_EQ(1, app_icon_loader1->fetch_count()); 2989 EXPECT_EQ(1, app_icon_loader1->fetch_count());
2916 EXPECT_EQ(1, app_icon_loader1->clear_count()); 2990 EXPECT_EQ(1, app_icon_loader1->clear_count());
2917 EXPECT_EQ(1, app_icon_loader2->fetch_count()); 2991 EXPECT_EQ(1, app_icon_loader2->fetch_count());
2918 EXPECT_EQ(1, app_icon_loader2->clear_count()); 2992 EXPECT_EQ(1, app_icon_loader2->clear_count());
2919 2993
2920 launcher_controller_->CloseLauncherItem(shelfId3); 2994 launcher_controller_->CloseLauncherItem(shelfId3);
2921 EXPECT_EQ(1, app_icon_loader1->fetch_count()); 2995 EXPECT_EQ(1, app_icon_loader1->fetch_count());
2922 EXPECT_EQ(1, app_icon_loader1->clear_count()); 2996 EXPECT_EQ(1, app_icon_loader1->clear_count());
2923 EXPECT_EQ(1, app_icon_loader2->fetch_count()); 2997 EXPECT_EQ(1, app_icon_loader2->fetch_count());
2924 EXPECT_EQ(1, app_icon_loader2->clear_count()); 2998 EXPECT_EQ(1, app_icon_loader2->clear_count());
2925 } 2999 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698