| 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 16 matching lines...) Expand all Loading... |
| 27 #include "chrome/browser/chrome_notification_types.h" | 27 #include "chrome/browser/chrome_notification_types.h" |
| 28 #include "chrome/browser/extensions/extension_apitest.h" | 28 #include "chrome/browser/extensions/extension_apitest.h" |
| 29 #include "chrome/browser/extensions/extension_browsertest.h" | 29 #include "chrome/browser/extensions/extension_browsertest.h" |
| 30 #include "chrome/browser/extensions/extension_function_test_utils.h" | 30 #include "chrome/browser/extensions/extension_function_test_utils.h" |
| 31 #include "chrome/browser/extensions/extension_service.h" | 31 #include "chrome/browser/extensions/extension_service.h" |
| 32 #include "chrome/browser/extensions/extension_system.h" | 32 #include "chrome/browser/extensions/extension_system.h" |
| 33 #include "chrome/browser/extensions/extension_test_message_listener.h" | 33 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 34 #include "chrome/browser/profiles/profile.h" | 34 #include "chrome/browser/profiles/profile.h" |
| 35 #include "chrome/browser/ui/app_list/app_list_service.h" | 35 #include "chrome/browser/ui/app_list/app_list_service.h" |
| 36 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" | 36 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" |
| 37 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" |
| 37 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" | 38 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" |
| 38 #include "chrome/browser/ui/browser.h" | 39 #include "chrome/browser/ui/browser.h" |
| 39 #include "chrome/browser/ui/browser_commands.h" | 40 #include "chrome/browser/ui/browser_commands.h" |
| 40 #include "chrome/browser/ui/browser_finder.h" | 41 #include "chrome/browser/ui/browser_finder.h" |
| 41 #include "chrome/browser/ui/browser_list.h" | 42 #include "chrome/browser/ui/browser_list.h" |
| 42 #include "chrome/browser/ui/browser_window.h" | 43 #include "chrome/browser/ui/browser_window.h" |
| 43 #include "chrome/browser/ui/extensions/application_launch.h" | 44 #include "chrome/browser/ui/extensions/application_launch.h" |
| 44 #include "chrome/browser/ui/host_desktop.h" | 45 #include "chrome/browser/ui/host_desktop.h" |
| 45 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 46 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 46 #include "chrome/common/chrome_switches.h" | 47 #include "chrome/common/chrome_switches.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 } | 145 } |
| 145 | 146 |
| 146 LauncherItemController* GetItemController(ash::LauncherID id) { | 147 LauncherItemController* GetItemController(ash::LauncherID id) { |
| 147 return controller_->id_to_item_controller_map_[id]; | 148 return controller_->id_to_item_controller_map_[id]; |
| 148 } | 149 } |
| 149 | 150 |
| 150 // Returns the number of menu items, ignoring separators. | 151 // Returns the number of menu items, ignoring separators. |
| 151 int GetNumApplicationMenuItems(const ash::LauncherItem& item) { | 152 int GetNumApplicationMenuItems(const ash::LauncherItem& item) { |
| 152 const int event_flags = 0; | 153 const int event_flags = 0; |
| 153 scoped_ptr<ash::LauncherMenuModel> menu( | 154 scoped_ptr<ash::LauncherMenuModel> menu( |
| 154 controller_->CreateApplicationMenu(item, event_flags)); | 155 new LauncherApplicationMenuItemModel( |
| 156 controller_->GetApplicationList(item, event_flags))); |
| 155 int num_items = 0; | 157 int num_items = 0; |
| 156 for (int i = 0; i < menu->GetItemCount(); ++i) { | 158 for (int i = 0; i < menu->GetItemCount(); ++i) { |
| 157 if (menu->GetTypeAt(i) != ui::MenuModel::TYPE_SEPARATOR) | 159 if (menu->GetTypeAt(i) != ui::MenuModel::TYPE_SEPARATOR) |
| 158 ++num_items; | 160 ++num_items; |
| 159 } | 161 } |
| 160 return num_items; | 162 return num_items; |
| 161 } | 163 } |
| 162 | 164 |
| 163 // Activate the launcher item with the given |id|. | 165 // Activate the launcher item with the given |id|. |
| 164 void ActivateLauncherItem(int id) { | 166 void ActivateLauncherItem(int id) { |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 653 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 652 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 654 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 653 // Confirm that a controller item was created and is the correct state. | 655 // Confirm that a controller item was created and is the correct state. |
| 654 const ash::LauncherItem& item1 = GetLastLauncherItem(); | 656 const ash::LauncherItem& item1 = GetLastLauncherItem(); |
| 655 LauncherItemController* item1_controller = GetItemController(item1.id); | 657 LauncherItemController* item1_controller = GetItemController(item1.id); |
| 656 EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type); | 658 EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type); |
| 657 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 659 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 658 EXPECT_EQ(LauncherItemController::TYPE_APP, item1_controller->type()); | 660 EXPECT_EQ(LauncherItemController::TYPE_APP, item1_controller->type()); |
| 659 // Clicking the item should have no effect. | 661 // Clicking the item should have no effect. |
| 660 TestEvent click_event(ui::ET_MOUSE_PRESSED); | 662 TestEvent click_event(ui::ET_MOUSE_PRESSED); |
| 661 item1_controller->Clicked(click_event); | 663 item1_controller->ItemSelected(click_event); |
| 662 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 664 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 663 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 665 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 664 // Minimize the window and confirm that the controller item is updated. | 666 // Minimize the window and confirm that the controller item is updated. |
| 665 window1->GetBaseWindow()->Minimize(); | 667 window1->GetBaseWindow()->Minimize(); |
| 666 EXPECT_FALSE(window1->GetNativeWindow()->IsVisible()); | 668 EXPECT_FALSE(window1->GetNativeWindow()->IsVisible()); |
| 667 EXPECT_FALSE(window1->GetBaseWindow()->IsActive()); | 669 EXPECT_FALSE(window1->GetBaseWindow()->IsActive()); |
| 668 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); | 670 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); |
| 669 // Clicking the item should activate the window. | 671 // Clicking the item should activate the window. |
| 670 item1_controller->Clicked(click_event); | 672 item1_controller->ItemSelected(click_event); |
| 671 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 673 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 672 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 674 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 673 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 675 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 674 // Maximizing a window should preserve state after minimize + click. | 676 // Maximizing a window should preserve state after minimize + click. |
| 675 window1->GetBaseWindow()->Maximize(); | 677 window1->GetBaseWindow()->Maximize(); |
| 676 window1->GetBaseWindow()->Minimize(); | 678 window1->GetBaseWindow()->Minimize(); |
| 677 item1_controller->Clicked(click_event); | 679 item1_controller->ItemSelected(click_event); |
| 678 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 680 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 679 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 681 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 680 EXPECT_TRUE(window1->GetBaseWindow()->IsMaximized()); | 682 EXPECT_TRUE(window1->GetBaseWindow()->IsMaximized()); |
| 681 } | 683 } |
| 682 | 684 |
| 683 // Confirm the minimizing click behavior for apps. | 685 // Confirm the minimizing click behavior for apps. |
| 684 IN_PROC_BROWSER_TEST_F(LauncherAppBrowserMinimizeOnClick, | 686 IN_PROC_BROWSER_TEST_F(LauncherAppBrowserMinimizeOnClick, |
| 685 PackagedAppClickBehaviorInMinimizeMode) { | 687 PackagedAppClickBehaviorInMinimizeMode) { |
| 686 // Launch one platform app and create a window for it. | 688 // Launch one platform app and create a window for it. |
| 687 const Extension* extension1 = LoadAndLaunchPlatformApp("launch"); | 689 const Extension* extension1 = LoadAndLaunchPlatformApp("launch"); |
| 688 ShellWindow* window1 = CreateShellWindow(extension1); | 690 ShellWindow* window1 = CreateShellWindow(extension1); |
| 689 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 691 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 690 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 692 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 691 | 693 |
| 692 // Confirm that a controller item was created and is the correct state. | 694 // Confirm that a controller item was created and is the correct state. |
| 693 const ash::LauncherItem& item1 = GetLastLauncherItem(); | 695 const ash::LauncherItem& item1 = GetLastLauncherItem(); |
| 694 LauncherItemController* item1_controller = GetItemController(item1.id); | 696 LauncherItemController* item1_controller = GetItemController(item1.id); |
| 695 EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type); | 697 EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type); |
| 696 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 698 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 697 EXPECT_EQ(LauncherItemController::TYPE_APP, item1_controller->type()); | 699 EXPECT_EQ(LauncherItemController::TYPE_APP, item1_controller->type()); |
| 698 // Since it is already active, clicking it should minimize. | 700 // Since it is already active, clicking it should minimize. |
| 699 TestEvent click_event(ui::ET_MOUSE_PRESSED); | 701 TestEvent click_event(ui::ET_MOUSE_PRESSED); |
| 700 item1_controller->Clicked(click_event); | 702 item1_controller->ItemSelected(click_event); |
| 701 EXPECT_FALSE(window1->GetNativeWindow()->IsVisible()); | 703 EXPECT_FALSE(window1->GetNativeWindow()->IsVisible()); |
| 702 EXPECT_FALSE(window1->GetBaseWindow()->IsActive()); | 704 EXPECT_FALSE(window1->GetBaseWindow()->IsActive()); |
| 703 EXPECT_TRUE(window1->GetBaseWindow()->IsMinimized()); | 705 EXPECT_TRUE(window1->GetBaseWindow()->IsMinimized()); |
| 704 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); | 706 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); |
| 705 // Clicking the item again should activate the window again. | 707 // Clicking the item again should activate the window again. |
| 706 item1_controller->Clicked(click_event); | 708 item1_controller->ItemSelected(click_event); |
| 707 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 709 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 708 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 710 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 709 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 711 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 710 // Maximizing a window should preserve state after minimize + click. | 712 // Maximizing a window should preserve state after minimize + click. |
| 711 window1->GetBaseWindow()->Maximize(); | 713 window1->GetBaseWindow()->Maximize(); |
| 712 window1->GetBaseWindow()->Minimize(); | 714 window1->GetBaseWindow()->Minimize(); |
| 713 item1_controller->Clicked(click_event); | 715 item1_controller->ItemSelected(click_event); |
| 714 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 716 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 715 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 717 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 716 EXPECT_TRUE(window1->GetBaseWindow()->IsMaximized()); | 718 EXPECT_TRUE(window1->GetBaseWindow()->IsMaximized()); |
| 717 window1->GetBaseWindow()->Restore(); | 719 window1->GetBaseWindow()->Restore(); |
| 718 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 720 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 719 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 721 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 720 EXPECT_FALSE(window1->GetBaseWindow()->IsMaximized()); | 722 EXPECT_FALSE(window1->GetBaseWindow()->IsMaximized()); |
| 721 | 723 |
| 722 // Creating a second window of the same type should change the behavior so | 724 // Creating a second window of the same type should change the behavior so |
| 723 // that a click does not change the activation state. | 725 // that a click does not change the activation state. |
| 724 ShellWindow* window1a = CreateShellWindow(extension1); | 726 ShellWindow* window1a = CreateShellWindow(extension1); |
| 725 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible()); | 727 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible()); |
| 726 EXPECT_TRUE(window1a->GetBaseWindow()->IsActive()); | 728 EXPECT_TRUE(window1a->GetBaseWindow()->IsActive()); |
| 727 // The first click does nothing. | 729 // The first click does nothing. |
| 728 item1_controller->Clicked(click_event); | 730 item1_controller->ItemSelected(click_event); |
| 729 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 731 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 730 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible()); | 732 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible()); |
| 731 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 733 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 732 EXPECT_FALSE(window1a->GetBaseWindow()->IsActive()); | 734 EXPECT_FALSE(window1a->GetBaseWindow()->IsActive()); |
| 733 // The second neither. | 735 // The second neither. |
| 734 item1_controller->Clicked(click_event); | 736 item1_controller->ItemSelected(click_event); |
| 735 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 737 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 736 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible()); | 738 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible()); |
| 737 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 739 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 738 EXPECT_FALSE(window1a->GetBaseWindow()->IsActive()); | 740 EXPECT_FALSE(window1a->GetBaseWindow()->IsActive()); |
| 739 } | 741 } |
| 740 | 742 |
| 741 // Confirm that click behavior for app panels is correct. | 743 // Confirm that click behavior for app panels is correct. |
| 742 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, AppPanelClickBehavior) { | 744 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, AppPanelClickBehavior) { |
| 743 // Enable experimental APIs to allow panel creation. | 745 // Enable experimental APIs to allow panel creation. |
| 744 CommandLine::ForCurrentProcess()->AppendSwitch( | 746 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 745 extensions::switches::kEnableExperimentalExtensionApis); | 747 extensions::switches::kEnableExperimentalExtensionApis); |
| 746 // Launch a platform app and create a panel window for it. | 748 // Launch a platform app and create a panel window for it. |
| 747 const Extension* extension1 = LoadAndLaunchPlatformApp("launch"); | 749 const Extension* extension1 = LoadAndLaunchPlatformApp("launch"); |
| 748 ShellWindow::CreateParams params; | 750 ShellWindow::CreateParams params; |
| 749 params.window_type = ShellWindow::WINDOW_TYPE_PANEL; | 751 params.window_type = ShellWindow::WINDOW_TYPE_PANEL; |
| 750 params.focused = false; | 752 params.focused = false; |
| 751 ShellWindow* panel = CreateShellWindowFromParams(extension1, params); | 753 ShellWindow* panel = CreateShellWindowFromParams(extension1, params); |
| 752 EXPECT_TRUE(panel->GetNativeWindow()->IsVisible()); | 754 EXPECT_TRUE(panel->GetNativeWindow()->IsVisible()); |
| 753 // Panels should not be active by default. | 755 // Panels should not be active by default. |
| 754 EXPECT_FALSE(panel->GetBaseWindow()->IsActive()); | 756 EXPECT_FALSE(panel->GetBaseWindow()->IsActive()); |
| 755 // Confirm that a controller item was created and is the correct state. | 757 // Confirm that a controller item was created and is the correct state. |
| 756 const ash::LauncherItem& item1 = GetLastLauncherPanelItem(); | 758 const ash::LauncherItem& item1 = GetLastLauncherPanelItem(); |
| 757 LauncherItemController* item1_controller = GetItemController(item1.id); | 759 LauncherItemController* item1_controller = GetItemController(item1.id); |
| 758 EXPECT_EQ(ash::TYPE_APP_PANEL, item1.type); | 760 EXPECT_EQ(ash::TYPE_APP_PANEL, item1.type); |
| 759 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); | 761 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); |
| 760 EXPECT_EQ(LauncherItemController::TYPE_APP_PANEL, item1_controller->type()); | 762 EXPECT_EQ(LauncherItemController::TYPE_APP_PANEL, item1_controller->type()); |
| 761 // Click the item and confirm that the panel is activated. | 763 // Click the item and confirm that the panel is activated. |
| 762 TestEvent click_event(ui::ET_MOUSE_PRESSED); | 764 TestEvent click_event(ui::ET_MOUSE_PRESSED); |
| 763 item1_controller->Clicked(click_event); | 765 item1_controller->ItemSelected(click_event); |
| 764 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); | 766 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); |
| 765 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 767 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 766 // Click the item again and confirm that the panel is minimized. | 768 // Click the item again and confirm that the panel is minimized. |
| 767 item1_controller->Clicked(click_event); | 769 item1_controller->ItemSelected(click_event); |
| 768 EXPECT_TRUE(panel->GetBaseWindow()->IsMinimized()); | 770 EXPECT_TRUE(panel->GetBaseWindow()->IsMinimized()); |
| 769 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); | 771 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); |
| 770 // Click the item again and confirm that the panel is activated. | 772 // Click the item again and confirm that the panel is activated. |
| 771 item1_controller->Clicked(click_event); | 773 item1_controller->ItemSelected(click_event); |
| 772 EXPECT_TRUE(panel->GetNativeWindow()->IsVisible()); | 774 EXPECT_TRUE(panel->GetNativeWindow()->IsVisible()); |
| 773 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); | 775 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); |
| 774 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 776 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 775 } | 777 } |
| 776 | 778 |
| 777 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, BrowserActivation) { | 779 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, BrowserActivation) { |
| 778 int item_count = launcher_model()->item_count(); | 780 int item_count = launcher_model()->item_count(); |
| 779 | 781 |
| 780 // First run app. | 782 // First run app. |
| 781 const Extension* extension1 = LoadAndLaunchPlatformApp("launch"); | 783 const Extension* extension1 = LoadAndLaunchPlatformApp("launch"); |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1413 EXPECT_EQ(ash::TYPE_APP_PANEL, item.type); | 1415 EXPECT_EQ(ash::TYPE_APP_PANEL, item.type); |
| 1414 EXPECT_EQ(ash::STATUS_RUNNING, item.status); | 1416 EXPECT_EQ(ash::STATUS_RUNNING, item.status); |
| 1415 EXPECT_EQ(LauncherItemController::TYPE_APP_PANEL, item_controller->type()); | 1417 EXPECT_EQ(LauncherItemController::TYPE_APP_PANEL, item_controller->type()); |
| 1416 | 1418 |
| 1417 // App windows should go to attention state. | 1419 // App windows should go to attention state. |
| 1418 panel->GetNativeWindow()->SetProperty(aura::client::kDrawAttentionKey, true); | 1420 panel->GetNativeWindow()->SetProperty(aura::client::kDrawAttentionKey, true); |
| 1419 EXPECT_EQ(ash::STATUS_ATTENTION, item.status); | 1421 EXPECT_EQ(ash::STATUS_ATTENTION, item.status); |
| 1420 | 1422 |
| 1421 // Click the item and confirm that the panel is activated. | 1423 // Click the item and confirm that the panel is activated. |
| 1422 TestEvent click_event(ui::ET_MOUSE_PRESSED); | 1424 TestEvent click_event(ui::ET_MOUSE_PRESSED); |
| 1423 item_controller->Clicked(click_event); | 1425 item_controller->ItemSelected(click_event); |
| 1424 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); | 1426 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); |
| 1425 EXPECT_EQ(ash::STATUS_ACTIVE, item.status); | 1427 EXPECT_EQ(ash::STATUS_ACTIVE, item.status); |
| 1426 | 1428 |
| 1427 // Active windows don't show attention. | 1429 // Active windows don't show attention. |
| 1428 panel->GetNativeWindow()->SetProperty(aura::client::kDrawAttentionKey, true); | 1430 panel->GetNativeWindow()->SetProperty(aura::client::kDrawAttentionKey, true); |
| 1429 EXPECT_EQ(ash::STATUS_ACTIVE, item.status); | 1431 EXPECT_EQ(ash::STATUS_ACTIVE, item.status); |
| 1430 } | 1432 } |
| 1431 | 1433 |
| 1432 // Checks that the browser Alt "tabbing" is properly done. | 1434 // Checks that the browser Alt "tabbing" is properly done. |
| 1433 IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTestNoDefaultBrowser, | 1435 IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTestNoDefaultBrowser, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1519 // Check that the LRU browser list does only contain the original browser. | 1521 // Check that the LRU browser list does only contain the original browser. |
| 1520 BrowserList* ash_browser_list = | 1522 BrowserList* ash_browser_list = |
| 1521 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | 1523 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); |
| 1522 BrowserList::const_reverse_iterator it = | 1524 BrowserList::const_reverse_iterator it = |
| 1523 ash_browser_list->begin_last_active(); | 1525 ash_browser_list->begin_last_active(); |
| 1524 EXPECT_EQ(*it, browser()); | 1526 EXPECT_EQ(*it, browser()); |
| 1525 ++it; | 1527 ++it; |
| 1526 EXPECT_EQ(it, ash_browser_list->end_last_active()); | 1528 EXPECT_EQ(it, ash_browser_list->end_last_active()); |
| 1527 | 1529 |
| 1528 // Now request to either activate an existing app or create a new one. | 1530 // Now request to either activate an existing app or create a new one. |
| 1529 controller_->ItemSelected(*model_->ItemByID(shortcut_id), | 1531 LauncherItemController* item_controller = |
| 1530 ui::KeyEvent(ui::ET_KEY_RELEASED, | 1532 controller_->GetLauncherItemController(shortcut_id); |
| 1533 item_controller->ItemSelected(ui::KeyEvent(ui::ET_KEY_RELEASED, |
| 1531 ui::VKEY_RETURN, | 1534 ui::VKEY_RETURN, |
| 1532 0, | 1535 0, |
| 1533 false)); | 1536 false)); |
| 1534 | 1537 |
| 1535 // Check that we have set focus on the existing application and nothing new | 1538 // Check that we have set focus on the existing application and nothing new |
| 1536 // was created. | 1539 // was created. |
| 1537 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); | 1540 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); |
| 1538 EXPECT_EQ(tab_count1, tab_strip->count()); | 1541 EXPECT_EQ(tab_count1, tab_strip->count()); |
| 1539 EXPECT_EQ(tab_count2, tab_strip2->count()); | 1542 EXPECT_EQ(tab_count2, tab_strip2->count()); |
| 1540 EXPECT_EQ(chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow()), | 1543 EXPECT_EQ(chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow()), |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1847 // Now show overflow bubble. | 1850 // Now show overflow bubble. |
| 1848 test.ShowOverflowBubble(); | 1851 test.ShowOverflowBubble(); |
| 1849 EXPECT_TRUE(launcher_->IsShowingOverflowBubble()); | 1852 EXPECT_TRUE(launcher_->IsShowingOverflowBubble()); |
| 1850 | 1853 |
| 1851 // Unpin first pinned app and there should be no crash. | 1854 // Unpin first pinned app and there should be no crash. |
| 1852 controller_->UnpinAppWithID(std::string("fake_app_0")); | 1855 controller_->UnpinAppWithID(std::string("fake_app_0")); |
| 1853 | 1856 |
| 1854 test.RunMessageLoopUntilAnimationsDone(); | 1857 test.RunMessageLoopUntilAnimationsDone(); |
| 1855 EXPECT_FALSE(launcher_->IsShowingOverflowBubble()); | 1858 EXPECT_FALSE(launcher_->IsShowingOverflowBubble()); |
| 1856 } | 1859 } |
| OLD | NEW |