| OLD | NEW |
| 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 "apps/native_app_window.h" | 7 #include "apps/native_app_window.h" |
| 8 #include "apps/shell_window.h" | 8 #include "apps/shell_window.h" |
| 9 #include "apps/shell_window_registry.h" | 9 #include "apps/shell_window_registry.h" |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "chrome/browser/chrome_notification_types.h" | 25 #include "chrome/browser/chrome_notification_types.h" |
| 26 #include "chrome/browser/extensions/extension_apitest.h" | 26 #include "chrome/browser/extensions/extension_apitest.h" |
| 27 #include "chrome/browser/extensions/extension_browsertest.h" | 27 #include "chrome/browser/extensions/extension_browsertest.h" |
| 28 #include "chrome/browser/extensions/extension_function_test_utils.h" | 28 #include "chrome/browser/extensions/extension_function_test_utils.h" |
| 29 #include "chrome/browser/extensions/extension_service.h" | 29 #include "chrome/browser/extensions/extension_service.h" |
| 30 #include "chrome/browser/extensions/extension_system.h" | 30 #include "chrome/browser/extensions/extension_system.h" |
| 31 #include "chrome/browser/extensions/extension_test_message_listener.h" | 31 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 32 #include "chrome/browser/profiles/profile.h" | 32 #include "chrome/browser/profiles/profile.h" |
| 33 #include "chrome/browser/ui/app_list/app_list_service.h" | 33 #include "chrome/browser/ui/app_list/app_list_service.h" |
| 34 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" | 34 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" |
| 35 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" |
| 35 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" | 36 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" |
| 36 #include "chrome/browser/ui/browser.h" | 37 #include "chrome/browser/ui/browser.h" |
| 37 #include "chrome/browser/ui/browser_commands.h" | 38 #include "chrome/browser/ui/browser_commands.h" |
| 38 #include "chrome/browser/ui/browser_finder.h" | 39 #include "chrome/browser/ui/browser_finder.h" |
| 39 #include "chrome/browser/ui/browser_list.h" | 40 #include "chrome/browser/ui/browser_list.h" |
| 40 #include "chrome/browser/ui/browser_window.h" | 41 #include "chrome/browser/ui/browser_window.h" |
| 41 #include "chrome/browser/ui/extensions/application_launch.h" | 42 #include "chrome/browser/ui/extensions/application_launch.h" |
| 42 #include "chrome/browser/ui/host_desktop.h" | 43 #include "chrome/browser/ui/host_desktop.h" |
| 43 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 44 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 44 #include "chrome/common/chrome_switches.h" | 45 #include "chrome/common/chrome_switches.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 } | 143 } |
| 143 | 144 |
| 144 LauncherItemController* GetItemController(ash::LauncherID id) { | 145 LauncherItemController* GetItemController(ash::LauncherID id) { |
| 145 return controller_->id_to_item_controller_map_[id]; | 146 return controller_->id_to_item_controller_map_[id]; |
| 146 } | 147 } |
| 147 | 148 |
| 148 // Returns the number of menu items, ignoring separators. | 149 // Returns the number of menu items, ignoring separators. |
| 149 int GetNumApplicationMenuItems(const ash::LauncherItem& item) { | 150 int GetNumApplicationMenuItems(const ash::LauncherItem& item) { |
| 150 const int event_flags = 0; | 151 const int event_flags = 0; |
| 151 scoped_ptr<ash::LauncherMenuModel> menu( | 152 scoped_ptr<ash::LauncherMenuModel> menu( |
| 152 controller_->CreateApplicationMenu(item, event_flags)); | 153 new LauncherApplicationMenuItemModel( |
| 154 controller_->GetApplicationList(item, event_flags))); |
| 153 int num_items = 0; | 155 int num_items = 0; |
| 154 for (int i = 0; i < menu->GetItemCount(); ++i) { | 156 for (int i = 0; i < menu->GetItemCount(); ++i) { |
| 155 if (menu->GetTypeAt(i) != ui::MenuModel::TYPE_SEPARATOR) | 157 if (menu->GetTypeAt(i) != ui::MenuModel::TYPE_SEPARATOR) |
| 156 ++num_items; | 158 ++num_items; |
| 157 } | 159 } |
| 158 return num_items; | 160 return num_items; |
| 159 } | 161 } |
| 160 | 162 |
| 161 // Activate the launcher item with the given |id|. | 163 // Activate the launcher item with the given |id|. |
| 162 void ActivateLauncherItem(int id) { | 164 void ActivateLauncherItem(int id) { |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 651 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 650 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 652 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 651 // Confirm that a controller item was created and is the correct state. | 653 // Confirm that a controller item was created and is the correct state. |
| 652 const ash::LauncherItem& item1 = GetLastLauncherItem(); | 654 const ash::LauncherItem& item1 = GetLastLauncherItem(); |
| 653 LauncherItemController* item1_controller = GetItemController(item1.id); | 655 LauncherItemController* item1_controller = GetItemController(item1.id); |
| 654 EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type); | 656 EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type); |
| 655 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 657 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 656 EXPECT_EQ(LauncherItemController::TYPE_APP, item1_controller->type()); | 658 EXPECT_EQ(LauncherItemController::TYPE_APP, item1_controller->type()); |
| 657 // Clicking the item should have no effect. | 659 // Clicking the item should have no effect. |
| 658 TestEvent click_event(ui::ET_MOUSE_PRESSED); | 660 TestEvent click_event(ui::ET_MOUSE_PRESSED); |
| 659 item1_controller->Clicked(click_event); | 661 item1_controller->ItemSelected(click_event); |
| 660 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 662 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 661 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 663 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 662 // Minimize the window and confirm that the controller item is updated. | 664 // Minimize the window and confirm that the controller item is updated. |
| 663 window1->GetBaseWindow()->Minimize(); | 665 window1->GetBaseWindow()->Minimize(); |
| 664 EXPECT_FALSE(window1->GetNativeWindow()->IsVisible()); | 666 EXPECT_FALSE(window1->GetNativeWindow()->IsVisible()); |
| 665 EXPECT_FALSE(window1->GetBaseWindow()->IsActive()); | 667 EXPECT_FALSE(window1->GetBaseWindow()->IsActive()); |
| 666 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); | 668 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); |
| 667 // Clicking the item should activate the window. | 669 // Clicking the item should activate the window. |
| 668 item1_controller->Clicked(click_event); | 670 item1_controller->ItemSelected(click_event); |
| 669 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 671 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 670 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 672 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 671 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 673 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 672 // Maximizing a window should preserve state after minimize + click. | 674 // Maximizing a window should preserve state after minimize + click. |
| 673 window1->GetBaseWindow()->Maximize(); | 675 window1->GetBaseWindow()->Maximize(); |
| 674 window1->GetBaseWindow()->Minimize(); | 676 window1->GetBaseWindow()->Minimize(); |
| 675 item1_controller->Clicked(click_event); | 677 item1_controller->ItemSelected(click_event); |
| 676 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 678 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 677 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 679 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 678 EXPECT_TRUE(window1->GetBaseWindow()->IsMaximized()); | 680 EXPECT_TRUE(window1->GetBaseWindow()->IsMaximized()); |
| 679 } | 681 } |
| 680 | 682 |
| 681 // Confirm the minimizing click behavior for apps. | 683 // Confirm the minimizing click behavior for apps. |
| 682 IN_PROC_BROWSER_TEST_F(LauncherAppBrowserMinimizeOnClick, | 684 IN_PROC_BROWSER_TEST_F(LauncherAppBrowserMinimizeOnClick, |
| 683 PackagedAppClickBehaviorInMinimizeMode) { | 685 PackagedAppClickBehaviorInMinimizeMode) { |
| 684 // Launch one platform app and create a window for it. | 686 // Launch one platform app and create a window for it. |
| 685 const Extension* extension1 = LoadAndLaunchPlatformApp("launch"); | 687 const Extension* extension1 = LoadAndLaunchPlatformApp("launch"); |
| 686 ShellWindow* window1 = CreateShellWindow(extension1); | 688 ShellWindow* window1 = CreateShellWindow(extension1); |
| 687 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 689 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 688 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 690 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 689 | 691 |
| 690 // Confirm that a controller item was created and is the correct state. | 692 // Confirm that a controller item was created and is the correct state. |
| 691 const ash::LauncherItem& item1 = GetLastLauncherItem(); | 693 const ash::LauncherItem& item1 = GetLastLauncherItem(); |
| 692 LauncherItemController* item1_controller = GetItemController(item1.id); | 694 LauncherItemController* item1_controller = GetItemController(item1.id); |
| 693 EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type); | 695 EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type); |
| 694 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 696 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 695 EXPECT_EQ(LauncherItemController::TYPE_APP, item1_controller->type()); | 697 EXPECT_EQ(LauncherItemController::TYPE_APP, item1_controller->type()); |
| 696 // Since it is already active, clicking it should minimize. | 698 // Since it is already active, clicking it should minimize. |
| 697 TestEvent click_event(ui::ET_MOUSE_PRESSED); | 699 TestEvent click_event(ui::ET_MOUSE_PRESSED); |
| 698 item1_controller->Clicked(click_event); | 700 item1_controller->ItemSelected(click_event); |
| 699 EXPECT_FALSE(window1->GetNativeWindow()->IsVisible()); | 701 EXPECT_FALSE(window1->GetNativeWindow()->IsVisible()); |
| 700 EXPECT_FALSE(window1->GetBaseWindow()->IsActive()); | 702 EXPECT_FALSE(window1->GetBaseWindow()->IsActive()); |
| 701 EXPECT_TRUE(window1->GetBaseWindow()->IsMinimized()); | 703 EXPECT_TRUE(window1->GetBaseWindow()->IsMinimized()); |
| 702 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); | 704 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); |
| 703 // Clicking the item again should activate the window again. | 705 // Clicking the item again should activate the window again. |
| 704 item1_controller->Clicked(click_event); | 706 item1_controller->ItemSelected(click_event); |
| 705 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 707 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 706 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 708 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 707 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 709 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 708 // Maximizing a window should preserve state after minimize + click. | 710 // Maximizing a window should preserve state after minimize + click. |
| 709 window1->GetBaseWindow()->Maximize(); | 711 window1->GetBaseWindow()->Maximize(); |
| 710 window1->GetBaseWindow()->Minimize(); | 712 window1->GetBaseWindow()->Minimize(); |
| 711 item1_controller->Clicked(click_event); | 713 item1_controller->ItemSelected(click_event); |
| 712 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 714 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 713 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 715 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 714 EXPECT_TRUE(window1->GetBaseWindow()->IsMaximized()); | 716 EXPECT_TRUE(window1->GetBaseWindow()->IsMaximized()); |
| 715 window1->GetBaseWindow()->Restore(); | 717 window1->GetBaseWindow()->Restore(); |
| 716 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 718 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 717 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 719 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 718 EXPECT_FALSE(window1->GetBaseWindow()->IsMaximized()); | 720 EXPECT_FALSE(window1->GetBaseWindow()->IsMaximized()); |
| 719 | 721 |
| 720 // Creating a second window of the same type should change the behavior so | 722 // Creating a second window of the same type should change the behavior so |
| 721 // that a click does not change the activation state. | 723 // that a click does not change the activation state. |
| 722 ShellWindow* window1a = CreateShellWindow(extension1); | 724 ShellWindow* window1a = CreateShellWindow(extension1); |
| 723 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible()); | 725 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible()); |
| 724 EXPECT_TRUE(window1a->GetBaseWindow()->IsActive()); | 726 EXPECT_TRUE(window1a->GetBaseWindow()->IsActive()); |
| 725 // The first click does nothing. | 727 // The first click does nothing. |
| 726 item1_controller->Clicked(click_event); | 728 item1_controller->ItemSelected(click_event); |
| 727 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 729 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 728 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible()); | 730 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible()); |
| 729 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 731 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 730 EXPECT_FALSE(window1a->GetBaseWindow()->IsActive()); | 732 EXPECT_FALSE(window1a->GetBaseWindow()->IsActive()); |
| 731 // The second neither. | 733 // The second neither. |
| 732 item1_controller->Clicked(click_event); | 734 item1_controller->ItemSelected(click_event); |
| 733 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 735 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 734 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible()); | 736 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible()); |
| 735 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 737 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 736 EXPECT_FALSE(window1a->GetBaseWindow()->IsActive()); | 738 EXPECT_FALSE(window1a->GetBaseWindow()->IsActive()); |
| 737 } | 739 } |
| 738 | 740 |
| 739 // Confirm that click behavior for app panels is correct. | 741 // Confirm that click behavior for app panels is correct. |
| 740 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, AppPanelClickBehavior) { | 742 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, AppPanelClickBehavior) { |
| 741 // Enable experimental APIs to allow panel creation. | 743 // Enable experimental APIs to allow panel creation. |
| 742 CommandLine::ForCurrentProcess()->AppendSwitch( | 744 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 743 extensions::switches::kEnableExperimentalExtensionApis); | 745 extensions::switches::kEnableExperimentalExtensionApis); |
| 744 // Launch a platform app and create a panel window for it. | 746 // Launch a platform app and create a panel window for it. |
| 745 const Extension* extension1 = LoadAndLaunchPlatformApp("launch"); | 747 const Extension* extension1 = LoadAndLaunchPlatformApp("launch"); |
| 746 ShellWindow::CreateParams params; | 748 ShellWindow::CreateParams params; |
| 747 params.window_type = ShellWindow::WINDOW_TYPE_PANEL; | 749 params.window_type = ShellWindow::WINDOW_TYPE_PANEL; |
| 748 params.focused = false; | 750 params.focused = false; |
| 749 ShellWindow* panel = CreateShellWindowFromParams(extension1, params); | 751 ShellWindow* panel = CreateShellWindowFromParams(extension1, params); |
| 750 EXPECT_TRUE(panel->GetNativeWindow()->IsVisible()); | 752 EXPECT_TRUE(panel->GetNativeWindow()->IsVisible()); |
| 751 // Panels should not be active by default. | 753 // Panels should not be active by default. |
| 752 EXPECT_FALSE(panel->GetBaseWindow()->IsActive()); | 754 EXPECT_FALSE(panel->GetBaseWindow()->IsActive()); |
| 753 // Confirm that a controller item was created and is the correct state. | 755 // Confirm that a controller item was created and is the correct state. |
| 754 const ash::LauncherItem& item1 = GetLastLauncherPanelItem(); | 756 const ash::LauncherItem& item1 = GetLastLauncherPanelItem(); |
| 755 LauncherItemController* item1_controller = GetItemController(item1.id); | 757 LauncherItemController* item1_controller = GetItemController(item1.id); |
| 756 EXPECT_EQ(ash::TYPE_APP_PANEL, item1.type); | 758 EXPECT_EQ(ash::TYPE_APP_PANEL, item1.type); |
| 757 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); | 759 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); |
| 758 EXPECT_EQ(LauncherItemController::TYPE_APP_PANEL, item1_controller->type()); | 760 EXPECT_EQ(LauncherItemController::TYPE_APP_PANEL, item1_controller->type()); |
| 759 // Click the item and confirm that the panel is activated. | 761 // Click the item and confirm that the panel is activated. |
| 760 TestEvent click_event(ui::ET_MOUSE_PRESSED); | 762 TestEvent click_event(ui::ET_MOUSE_PRESSED); |
| 761 item1_controller->Clicked(click_event); | 763 item1_controller->ItemSelected(click_event); |
| 762 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); | 764 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); |
| 763 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 765 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 764 // Click the item again and confirm that the panel is minimized. | 766 // Click the item again and confirm that the panel is minimized. |
| 765 item1_controller->Clicked(click_event); | 767 item1_controller->ItemSelected(click_event); |
| 766 EXPECT_TRUE(panel->GetBaseWindow()->IsMinimized()); | 768 EXPECT_TRUE(panel->GetBaseWindow()->IsMinimized()); |
| 767 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); | 769 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); |
| 768 // Click the item again and confirm that the panel is activated. | 770 // Click the item again and confirm that the panel is activated. |
| 769 item1_controller->Clicked(click_event); | 771 item1_controller->ItemSelected(click_event); |
| 770 EXPECT_TRUE(panel->GetNativeWindow()->IsVisible()); | 772 EXPECT_TRUE(panel->GetNativeWindow()->IsVisible()); |
| 771 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); | 773 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); |
| 772 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 774 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 773 } | 775 } |
| 774 | 776 |
| 775 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, BrowserActivation) { | 777 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, BrowserActivation) { |
| 776 int item_count = launcher_model()->item_count(); | 778 int item_count = launcher_model()->item_count(); |
| 777 | 779 |
| 778 // First run app. | 780 // First run app. |
| 779 const Extension* extension1 = LoadAndLaunchPlatformApp("launch"); | 781 const Extension* extension1 = LoadAndLaunchPlatformApp("launch"); |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1355 EXPECT_EQ(ash::TYPE_APP_PANEL, item.type); | 1357 EXPECT_EQ(ash::TYPE_APP_PANEL, item.type); |
| 1356 EXPECT_EQ(ash::STATUS_RUNNING, item.status); | 1358 EXPECT_EQ(ash::STATUS_RUNNING, item.status); |
| 1357 EXPECT_EQ(LauncherItemController::TYPE_APP_PANEL, item_controller->type()); | 1359 EXPECT_EQ(LauncherItemController::TYPE_APP_PANEL, item_controller->type()); |
| 1358 | 1360 |
| 1359 // App windows should go to attention state. | 1361 // App windows should go to attention state. |
| 1360 panel->GetNativeWindow()->SetProperty(aura::client::kDrawAttentionKey, true); | 1362 panel->GetNativeWindow()->SetProperty(aura::client::kDrawAttentionKey, true); |
| 1361 EXPECT_EQ(ash::STATUS_ATTENTION, item.status); | 1363 EXPECT_EQ(ash::STATUS_ATTENTION, item.status); |
| 1362 | 1364 |
| 1363 // Click the item and confirm that the panel is activated. | 1365 // Click the item and confirm that the panel is activated. |
| 1364 TestEvent click_event(ui::ET_MOUSE_PRESSED); | 1366 TestEvent click_event(ui::ET_MOUSE_PRESSED); |
| 1365 item_controller->Clicked(click_event); | 1367 item_controller->ItemSelected(click_event); |
| 1366 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); | 1368 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); |
| 1367 EXPECT_EQ(ash::STATUS_ACTIVE, item.status); | 1369 EXPECT_EQ(ash::STATUS_ACTIVE, item.status); |
| 1368 | 1370 |
| 1369 // Active windows don't show attention. | 1371 // Active windows don't show attention. |
| 1370 panel->GetNativeWindow()->SetProperty(aura::client::kDrawAttentionKey, true); | 1372 panel->GetNativeWindow()->SetProperty(aura::client::kDrawAttentionKey, true); |
| 1371 EXPECT_EQ(ash::STATUS_ACTIVE, item.status); | 1373 EXPECT_EQ(ash::STATUS_ACTIVE, item.status); |
| 1372 } | 1374 } |
| 1373 | 1375 |
| 1374 // Checks that the browser Alt "tabbing" is properly done. | 1376 // Checks that the browser Alt "tabbing" is properly done. |
| 1375 IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTestNoDefaultBrowser, | 1377 IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTestNoDefaultBrowser, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1461 // Check that the LRU browser list does only contain the original browser. | 1463 // Check that the LRU browser list does only contain the original browser. |
| 1462 BrowserList* ash_browser_list = | 1464 BrowserList* ash_browser_list = |
| 1463 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | 1465 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); |
| 1464 BrowserList::const_reverse_iterator it = | 1466 BrowserList::const_reverse_iterator it = |
| 1465 ash_browser_list->begin_last_active(); | 1467 ash_browser_list->begin_last_active(); |
| 1466 EXPECT_EQ(*it, browser()); | 1468 EXPECT_EQ(*it, browser()); |
| 1467 ++it; | 1469 ++it; |
| 1468 EXPECT_EQ(it, ash_browser_list->end_last_active()); | 1470 EXPECT_EQ(it, ash_browser_list->end_last_active()); |
| 1469 | 1471 |
| 1470 // Now request to either activate an existing app or create a new one. | 1472 // Now request to either activate an existing app or create a new one. |
| 1471 controller_->ItemSelected(*model_->ItemByID(shortcut_id), | 1473 LauncherItemController* item_controller = |
| 1472 ui::KeyEvent(ui::ET_KEY_RELEASED, | 1474 controller_->GetLauncherItemController(shortcut_id); |
| 1475 item_controller->ItemSelected(ui::KeyEvent(ui::ET_KEY_RELEASED, |
| 1473 ui::VKEY_RETURN, | 1476 ui::VKEY_RETURN, |
| 1474 0, | 1477 0, |
| 1475 false)); | 1478 false)); |
| 1476 | 1479 |
| 1477 // Check that we have set focus on the existing application and nothing new | 1480 // Check that we have set focus on the existing application and nothing new |
| 1478 // was created. | 1481 // was created. |
| 1479 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); | 1482 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); |
| 1480 EXPECT_EQ(tab_count1, tab_strip->count()); | 1483 EXPECT_EQ(tab_count1, tab_strip->count()); |
| 1481 EXPECT_EQ(tab_count2, tab_strip2->count()); | 1484 EXPECT_EQ(tab_count2, tab_strip2->count()); |
| 1482 EXPECT_EQ(chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow()), | 1485 EXPECT_EQ(chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow()), |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1771 // Now show overflow bubble. | 1774 // Now show overflow bubble. |
| 1772 test.ShowOverflowBubble(); | 1775 test.ShowOverflowBubble(); |
| 1773 EXPECT_TRUE(launcher_->IsShowingOverflowBubble()); | 1776 EXPECT_TRUE(launcher_->IsShowingOverflowBubble()); |
| 1774 | 1777 |
| 1775 // Unpin first pinned app and there should be no crash. | 1778 // Unpin first pinned app and there should be no crash. |
| 1776 controller_->UnpinAppWithID(std::string("fake_app_0")); | 1779 controller_->UnpinAppWithID(std::string("fake_app_0")); |
| 1777 | 1780 |
| 1778 test.RunMessageLoopUntilAnimationsDone(); | 1781 test.RunMessageLoopUntilAnimationsDone(); |
| 1779 EXPECT_FALSE(launcher_->IsShowingOverflowBubble()); | 1782 EXPECT_FALSE(launcher_->IsShowingOverflowBubble()); |
| 1780 } | 1783 } |
| OLD | NEW |