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