| 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_impl.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "ash/common/shelf/app_list_button.h" | 9 #include "ash/common/shelf/app_list_button.h" |
| 10 #include "ash/common/shelf/shelf_button.h" | 10 #include "ash/common/shelf/shelf_button.h" |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 AppWindow* window1 = CreateAppWindow(browser()->profile(), extension1); | 696 AppWindow* window1 = CreateAppWindow(browser()->profile(), extension1); |
| 697 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 697 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 698 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 698 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 699 | 699 |
| 700 // Confirm that a controller item was created and is the correct state. | 700 // Confirm that a controller item was created and is the correct state. |
| 701 const ash::ShelfItem& item1 = GetLastLauncherItem(); | 701 const ash::ShelfItem& item1 = GetLastLauncherItem(); |
| 702 LauncherItemController* item1_controller = GetItemController(item1.id); | 702 LauncherItemController* item1_controller = GetItemController(item1.id); |
| 703 EXPECT_EQ(ash::TYPE_APP, item1.type); | 703 EXPECT_EQ(ash::TYPE_APP, item1.type); |
| 704 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 704 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 705 // Since it is already active, clicking it should minimize. | 705 // Since it is already active, clicking it should minimize. |
| 706 TestEvent click_event(ui::ET_MOUSE_PRESSED); | 706 item1_controller->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, |
| 707 item1_controller->ItemSelected(click_event); | 707 display::kInvalidDisplayId, |
| 708 ash::LAUNCH_FROM_UNKNOWN); |
| 708 EXPECT_FALSE(window1->GetNativeWindow()->IsVisible()); | 709 EXPECT_FALSE(window1->GetNativeWindow()->IsVisible()); |
| 709 EXPECT_FALSE(window1->GetBaseWindow()->IsActive()); | 710 EXPECT_FALSE(window1->GetBaseWindow()->IsActive()); |
| 710 EXPECT_TRUE(window1->GetBaseWindow()->IsMinimized()); | 711 EXPECT_TRUE(window1->GetBaseWindow()->IsMinimized()); |
| 711 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); | 712 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); |
| 712 // Clicking the item again should activate the window again. | 713 // Clicking the item again should activate the window again. |
| 713 item1_controller->ItemSelected(click_event); | 714 item1_controller->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, |
| 715 display::kInvalidDisplayId, |
| 716 ash::LAUNCH_FROM_UNKNOWN); |
| 714 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 717 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 715 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 718 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 716 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 719 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 717 // Maximizing a window should preserve state after minimize + click. | 720 // Maximizing a window should preserve state after minimize + click. |
| 718 window1->GetBaseWindow()->Maximize(); | 721 window1->GetBaseWindow()->Maximize(); |
| 719 window1->GetBaseWindow()->Minimize(); | 722 window1->GetBaseWindow()->Minimize(); |
| 720 item1_controller->ItemSelected(click_event); | 723 item1_controller->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, |
| 724 display::kInvalidDisplayId, |
| 725 ash::LAUNCH_FROM_UNKNOWN); |
| 721 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 726 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 722 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 727 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 723 EXPECT_TRUE(window1->GetBaseWindow()->IsMaximized()); | 728 EXPECT_TRUE(window1->GetBaseWindow()->IsMaximized()); |
| 724 window1->GetBaseWindow()->Restore(); | 729 window1->GetBaseWindow()->Restore(); |
| 725 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 730 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 726 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 731 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 727 EXPECT_FALSE(window1->GetBaseWindow()->IsMaximized()); | 732 EXPECT_FALSE(window1->GetBaseWindow()->IsMaximized()); |
| 728 | 733 |
| 729 // Creating a second window of the same type should change the behavior so | 734 // Creating a second window of the same type should change the behavior so |
| 730 // that a click does not change the activation state. | 735 // that a click does not change the activation state. |
| 731 AppWindow* window1a = CreateAppWindow(browser()->profile(), extension1); | 736 AppWindow* window1a = CreateAppWindow(browser()->profile(), extension1); |
| 732 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible()); | 737 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible()); |
| 733 EXPECT_TRUE(window1a->GetBaseWindow()->IsActive()); | 738 EXPECT_TRUE(window1a->GetBaseWindow()->IsActive()); |
| 734 // The first click does nothing. | 739 // The first click does nothing. |
| 735 item1_controller->ItemSelected(click_event); | 740 item1_controller->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, |
| 741 display::kInvalidDisplayId, |
| 742 ash::LAUNCH_FROM_UNKNOWN); |
| 736 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 743 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 737 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible()); | 744 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible()); |
| 738 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 745 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 739 EXPECT_FALSE(window1a->GetBaseWindow()->IsActive()); | 746 EXPECT_FALSE(window1a->GetBaseWindow()->IsActive()); |
| 740 // The second neither. | 747 // The second neither. |
| 741 item1_controller->ItemSelected(click_event); | 748 item1_controller->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, |
| 749 display::kInvalidDisplayId, |
| 750 ash::LAUNCH_FROM_UNKNOWN); |
| 742 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); | 751 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); |
| 743 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible()); | 752 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible()); |
| 744 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); | 753 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); |
| 745 EXPECT_FALSE(window1a->GetBaseWindow()->IsActive()); | 754 EXPECT_FALSE(window1a->GetBaseWindow()->IsActive()); |
| 746 } | 755 } |
| 747 | 756 |
| 748 // Confirm that ash::ShelfWindowWatcher correctly handles app panels. | 757 // Confirm that ash::ShelfWindowWatcher correctly handles app panels. |
| 749 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, AppPanel) { | 758 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, AppPanel) { |
| 750 // Enable experimental APIs to allow panel creation. | 759 // Enable experimental APIs to allow panel creation. |
| 751 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 760 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 763 // Confirm that an item delegate was created and is in the correct state. | 772 // Confirm that an item delegate was created and is in the correct state. |
| 764 const ash::ShelfItem& item1 = GetLastLauncherPanelItem(); | 773 const ash::ShelfItem& item1 = GetLastLauncherPanelItem(); |
| 765 EXPECT_EQ(ash::TYPE_APP_PANEL, item1.type); | 774 EXPECT_EQ(ash::TYPE_APP_PANEL, item1.type); |
| 766 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); | 775 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); |
| 767 EXPECT_EQ(nullptr, GetItemController(item1.id)); | 776 EXPECT_EQ(nullptr, GetItemController(item1.id)); |
| 768 ash::ShelfItemDelegate* item1_delegate = | 777 ash::ShelfItemDelegate* item1_delegate = |
| 769 shelf_model()->GetShelfItemDelegate(item1.id); | 778 shelf_model()->GetShelfItemDelegate(item1.id); |
| 770 EXPECT_EQ(ash::TYPE_APP_PANEL, | 779 EXPECT_EQ(ash::TYPE_APP_PANEL, |
| 771 panel->GetNativeWindow()->GetProperty(ash::kShelfItemTypeKey)); | 780 panel->GetNativeWindow()->GetProperty(ash::kShelfItemTypeKey)); |
| 772 // Click the item and confirm that the panel is activated. | 781 // Click the item and confirm that the panel is activated. |
| 773 TestEvent click_event(ui::ET_MOUSE_PRESSED); | 782 item1_delegate->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, |
| 774 item1_delegate->ItemSelected(click_event); | 783 display::kInvalidDisplayId, |
| 784 ash::LAUNCH_FROM_UNKNOWN); |
| 775 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); | 785 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); |
| 776 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 786 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 777 // Click the item again and confirm that the panel is minimized. | 787 // Click the item again and confirm that the panel is minimized. |
| 778 item1_delegate->ItemSelected(click_event); | 788 item1_delegate->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, |
| 789 display::kInvalidDisplayId, |
| 790 ash::LAUNCH_FROM_UNKNOWN); |
| 779 EXPECT_TRUE(panel->GetBaseWindow()->IsMinimized()); | 791 EXPECT_TRUE(panel->GetBaseWindow()->IsMinimized()); |
| 780 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); | 792 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); |
| 781 // Click the item again and confirm that the panel is activated. | 793 // Click the item again and confirm that the panel is activated. |
| 782 item1_delegate->ItemSelected(click_event); | 794 item1_delegate->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, |
| 795 display::kInvalidDisplayId, |
| 796 ash::LAUNCH_FROM_UNKNOWN); |
| 783 EXPECT_TRUE(panel->GetNativeWindow()->IsVisible()); | 797 EXPECT_TRUE(panel->GetNativeWindow()->IsVisible()); |
| 784 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); | 798 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); |
| 785 EXPECT_FALSE(panel->GetBaseWindow()->IsMinimized()); | 799 EXPECT_FALSE(panel->GetBaseWindow()->IsMinimized()); |
| 786 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 800 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 787 } | 801 } |
| 788 | 802 |
| 789 // Confirm that click behavior for app panels is correct. | 803 // Confirm that click behavior for app panels is correct. |
| 790 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, AppPanelClickBehavior) { | 804 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, AppPanelClickBehavior) { |
| 791 // Enable experimental APIs to allow panel creation. | 805 // Enable experimental APIs to allow panel creation. |
| 792 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 806 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 804 // Confirm that an item delegate was created and is in the correct state. | 818 // Confirm that an item delegate was created and is in the correct state. |
| 805 const ash::ShelfItem& item1 = GetLastLauncherPanelItem(); | 819 const ash::ShelfItem& item1 = GetLastLauncherPanelItem(); |
| 806 EXPECT_EQ(ash::TYPE_APP_PANEL, item1.type); | 820 EXPECT_EQ(ash::TYPE_APP_PANEL, item1.type); |
| 807 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); | 821 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); |
| 808 EXPECT_EQ(nullptr, GetItemController(item1.id)); | 822 EXPECT_EQ(nullptr, GetItemController(item1.id)); |
| 809 ash::ShelfItemDelegate* item1_delegate = | 823 ash::ShelfItemDelegate* item1_delegate = |
| 810 shelf_model()->GetShelfItemDelegate(item1.id); | 824 shelf_model()->GetShelfItemDelegate(item1.id); |
| 811 EXPECT_EQ(ash::TYPE_APP_PANEL, | 825 EXPECT_EQ(ash::TYPE_APP_PANEL, |
| 812 panel->GetNativeWindow()->GetProperty(ash::kShelfItemTypeKey)); | 826 panel->GetNativeWindow()->GetProperty(ash::kShelfItemTypeKey)); |
| 813 // Click the item and confirm that the panel is activated. | 827 // Click the item and confirm that the panel is activated. |
| 814 TestEvent click_event(ui::ET_MOUSE_PRESSED); | 828 item1_delegate->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, |
| 815 item1_delegate->ItemSelected(click_event); | 829 display::kInvalidDisplayId, |
| 830 ash::LAUNCH_FROM_UNKNOWN); |
| 816 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); | 831 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); |
| 817 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 832 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 818 // Click the item again and confirm that the panel is minimized. | 833 // Click the item again and confirm that the panel is minimized. |
| 819 item1_delegate->ItemSelected(click_event); | 834 item1_delegate->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, |
| 835 display::kInvalidDisplayId, |
| 836 ash::LAUNCH_FROM_UNKNOWN); |
| 820 EXPECT_TRUE(panel->GetBaseWindow()->IsMinimized()); | 837 EXPECT_TRUE(panel->GetBaseWindow()->IsMinimized()); |
| 821 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); | 838 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); |
| 822 // Click the item again and confirm that the panel is activated. | 839 // Click the item again and confirm that the panel is activated. |
| 823 item1_delegate->ItemSelected(click_event); | 840 item1_delegate->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, |
| 841 display::kInvalidDisplayId, |
| 842 ash::LAUNCH_FROM_UNKNOWN); |
| 824 EXPECT_TRUE(panel->GetNativeWindow()->IsVisible()); | 843 EXPECT_TRUE(panel->GetNativeWindow()->IsVisible()); |
| 825 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); | 844 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); |
| 826 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); | 845 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); |
| 827 } | 846 } |
| 828 | 847 |
| 829 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, BrowserActivation) { | 848 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, BrowserActivation) { |
| 830 int item_count = shelf_model()->item_count(); | 849 int item_count = shelf_model()->item_count(); |
| 831 | 850 |
| 832 // First run app. | 851 // First run app. |
| 833 const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched"); | 852 const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched"); |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1518 shelf_model()->GetShelfItemDelegate(item.id); | 1537 shelf_model()->GetShelfItemDelegate(item.id); |
| 1519 EXPECT_NE(nullptr, shelf_item_delegate); | 1538 EXPECT_NE(nullptr, shelf_item_delegate); |
| 1520 EXPECT_EQ(ash::TYPE_APP_PANEL, item.type); | 1539 EXPECT_EQ(ash::TYPE_APP_PANEL, item.type); |
| 1521 EXPECT_EQ(ash::STATUS_RUNNING, item.status); | 1540 EXPECT_EQ(ash::STATUS_RUNNING, item.status); |
| 1522 | 1541 |
| 1523 // App windows should go to attention state. | 1542 // App windows should go to attention state. |
| 1524 panel->GetNativeWindow()->SetProperty(aura::client::kDrawAttentionKey, true); | 1543 panel->GetNativeWindow()->SetProperty(aura::client::kDrawAttentionKey, true); |
| 1525 EXPECT_EQ(ash::STATUS_ATTENTION, item.status); | 1544 EXPECT_EQ(ash::STATUS_ATTENTION, item.status); |
| 1526 | 1545 |
| 1527 // Click the item and confirm that the panel is activated. | 1546 // Click the item and confirm that the panel is activated. |
| 1528 TestEvent click_event(ui::ET_MOUSE_PRESSED); | 1547 EXPECT_EQ(ash::SHELF_ACTION_WINDOW_ACTIVATED, |
| 1529 EXPECT_EQ(ash::ShelfItemDelegate::kExistingWindowActivated, | 1548 shelf_item_delegate->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, |
| 1530 shelf_item_delegate->ItemSelected(click_event)); | 1549 display::kInvalidDisplayId, |
| 1550 ash::LAUNCH_FROM_UNKNOWN)); |
| 1531 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); | 1551 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); |
| 1532 EXPECT_EQ(ash::STATUS_ACTIVE, item.status); | 1552 EXPECT_EQ(ash::STATUS_ACTIVE, item.status); |
| 1533 | 1553 |
| 1534 // Active windows don't show attention. | 1554 // Active windows don't show attention. |
| 1535 panel->GetNativeWindow()->SetProperty(aura::client::kDrawAttentionKey, true); | 1555 panel->GetNativeWindow()->SetProperty(aura::client::kDrawAttentionKey, true); |
| 1536 EXPECT_EQ(ash::STATUS_ACTIVE, item.status); | 1556 EXPECT_EQ(ash::STATUS_ACTIVE, item.status); |
| 1537 } | 1557 } |
| 1538 | 1558 |
| 1539 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, | 1559 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, |
| 1540 ShowInShelfWindowsWithWindowKeySet) { | 1560 ShowInShelfWindowsWithWindowKeySet) { |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1735 // Check that the LRU browser list does only contain the original browser. | 1755 // Check that the LRU browser list does only contain the original browser. |
| 1736 BrowserList* browser_list = BrowserList::GetInstance(); | 1756 BrowserList* browser_list = BrowserList::GetInstance(); |
| 1737 BrowserList::const_reverse_iterator it = browser_list->begin_last_active(); | 1757 BrowserList::const_reverse_iterator it = browser_list->begin_last_active(); |
| 1738 EXPECT_EQ(*it, browser()); | 1758 EXPECT_EQ(*it, browser()); |
| 1739 ++it; | 1759 ++it; |
| 1740 EXPECT_EQ(it, browser_list->end_last_active()); | 1760 EXPECT_EQ(it, browser_list->end_last_active()); |
| 1741 | 1761 |
| 1742 // Now request to either activate an existing app or create a new one. | 1762 // Now request to either activate an existing app or create a new one. |
| 1743 LauncherItemController* item_controller = | 1763 LauncherItemController* item_controller = |
| 1744 controller_->GetLauncherItemController(shortcut_id); | 1764 controller_->GetLauncherItemController(shortcut_id); |
| 1745 item_controller->ItemSelected(ui::KeyEvent(ui::ET_KEY_RELEASED, | 1765 item_controller->ItemSelected(ui::ET_KEY_RELEASED, ui::EF_NONE, |
| 1746 ui::VKEY_RETURN, | 1766 display::kInvalidDisplayId, |
| 1747 ui::EF_NONE)); | 1767 ash::LAUNCH_FROM_UNKNOWN); |
| 1748 | 1768 |
| 1749 // Check that we have set focus on the existing application and nothing new | 1769 // Check that we have set focus on the existing application and nothing new |
| 1750 // was created. | 1770 // was created. |
| 1751 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); | 1771 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); |
| 1752 EXPECT_EQ(tab_count1, tab_strip->count()); | 1772 EXPECT_EQ(tab_count1, tab_strip->count()); |
| 1753 EXPECT_EQ(tab_count2, tab_strip2->count()); | 1773 EXPECT_EQ(tab_count2, tab_strip2->count()); |
| 1754 EXPECT_EQ(chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow()), | 1774 EXPECT_EQ(chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow()), |
| 1755 browser2); | 1775 browser2); |
| 1756 } | 1776 } |
| 1757 | 1777 |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2121 controller_->GetBrowserShortcutLauncherItemController(); | 2141 controller_->GetBrowserShortcutLauncherItemController(); |
| 2122 const ash::ShelfID id = item_controller->shelf_id(); | 2142 const ash::ShelfID id = item_controller->shelf_id(); |
| 2123 EXPECT_NE(ash::kInvalidShelfID, id); | 2143 EXPECT_NE(ash::kInvalidShelfID, id); |
| 2124 | 2144 |
| 2125 // Get the number of browsers. | 2145 // Get the number of browsers. |
| 2126 size_t running_browser = chrome::GetTotalBrowserCount(); | 2146 size_t running_browser = chrome::GetTotalBrowserCount(); |
| 2127 EXPECT_EQ(0u, running_browser); | 2147 EXPECT_EQ(0u, running_browser); |
| 2128 EXPECT_FALSE(controller_->IsOpen(id)); | 2148 EXPECT_FALSE(controller_->IsOpen(id)); |
| 2129 | 2149 |
| 2130 // Activate. This creates new browser | 2150 // Activate. This creates new browser |
| 2131 item_controller->Activate(ash::LAUNCH_FROM_UNKNOWN); | 2151 item_controller->ItemSelected(ui::ET_UNKNOWN, ui::EF_NONE, |
| 2152 display::kInvalidDisplayId, |
| 2153 ash::LAUNCH_FROM_UNKNOWN); |
| 2132 // New Window is created. | 2154 // New Window is created. |
| 2133 running_browser = chrome::GetTotalBrowserCount(); | 2155 running_browser = chrome::GetTotalBrowserCount(); |
| 2134 EXPECT_EQ(1u, running_browser); | 2156 EXPECT_EQ(1u, running_browser); |
| 2135 EXPECT_TRUE(controller_->IsOpen(id)); | 2157 EXPECT_TRUE(controller_->IsOpen(id)); |
| 2136 | 2158 |
| 2137 // Minimize Window. | 2159 // Minimize Window. |
| 2138 ash::wm::WindowState* window_state = ash::wm::GetActiveWindowState(); | 2160 ash::wm::WindowState* window_state = ash::wm::GetActiveWindowState(); |
| 2139 window_state->Minimize(); | 2161 window_state->Minimize(); |
| 2140 EXPECT_TRUE(window_state->IsMinimized()); | 2162 EXPECT_TRUE(window_state->IsMinimized()); |
| 2141 | 2163 |
| 2142 // Activate again. This doesn't create new browser. | 2164 // Activate again. This doesn't create new browser, it activates the window. |
| 2143 // It activates window. | 2165 item_controller->ItemSelected(ui::ET_UNKNOWN, ui::EF_NONE, |
| 2144 item_controller->Activate(ash::LAUNCH_FROM_UNKNOWN); | 2166 display::kInvalidDisplayId, |
| 2167 ash::LAUNCH_FROM_UNKNOWN); |
| 2145 running_browser = chrome::GetTotalBrowserCount(); | 2168 running_browser = chrome::GetTotalBrowserCount(); |
| 2146 EXPECT_EQ(1u, running_browser); | 2169 EXPECT_EQ(1u, running_browser); |
| 2147 EXPECT_TRUE(controller_->IsOpen(id)); | 2170 EXPECT_TRUE(controller_->IsOpen(id)); |
| 2148 EXPECT_FALSE(window_state->IsMinimized()); | 2171 EXPECT_FALSE(window_state->IsMinimized()); |
| 2149 } | 2172 } |
| 2150 | 2173 |
| 2151 // Check that the window's ShelfID property matches that of the active tab. | 2174 // Check that the window's ShelfID property matches that of the active tab. |
| 2152 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MatchingShelfIDandActiveTab) { | 2175 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MatchingShelfIDandActiveTab) { |
| 2153 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 2176 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
| 2154 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 2177 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2390 | 2413 |
| 2391 // Close all windows via the menu item. | 2414 // Close all windows via the menu item. |
| 2392 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); | 2415 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); |
| 2393 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); | 2416 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); |
| 2394 | 2417 |
| 2395 // Check if "Close" is removed from the context menu. | 2418 // Check if "Close" is removed from the context menu. |
| 2396 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); | 2419 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); |
| 2397 ASSERT_FALSE( | 2420 ASSERT_FALSE( |
| 2398 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); | 2421 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); |
| 2399 } | 2422 } |
| OLD | NEW |