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

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

Issue 2696073002: Merge ShelfItemDelegate::ItemSelected & LauncherItemDelegate::Activate. (Closed)
Patch Set: Cleanup Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_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
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 int64_t display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
707 item1_controller->ItemSelected(click_event); 707 item1_controller->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, display_id,
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, display_id,
715 ash::LAUNCH_FROM_UNKNOWN);
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_EQ(ash::STATUS_ACTIVE, item1.status); 718 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
717 // Maximizing a window should preserve state after minimize + click. 719 // Maximizing a window should preserve state after minimize + click.
718 window1->GetBaseWindow()->Maximize(); 720 window1->GetBaseWindow()->Maximize();
719 window1->GetBaseWindow()->Minimize(); 721 window1->GetBaseWindow()->Minimize();
720 item1_controller->ItemSelected(click_event); 722 item1_controller->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, display_id,
723 ash::LAUNCH_FROM_UNKNOWN);
721 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); 724 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible());
722 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); 725 EXPECT_TRUE(window1->GetBaseWindow()->IsActive());
723 EXPECT_TRUE(window1->GetBaseWindow()->IsMaximized()); 726 EXPECT_TRUE(window1->GetBaseWindow()->IsMaximized());
724 window1->GetBaseWindow()->Restore(); 727 window1->GetBaseWindow()->Restore();
725 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); 728 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible());
726 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); 729 EXPECT_TRUE(window1->GetBaseWindow()->IsActive());
727 EXPECT_FALSE(window1->GetBaseWindow()->IsMaximized()); 730 EXPECT_FALSE(window1->GetBaseWindow()->IsMaximized());
728 731
729 // Creating a second window of the same type should change the behavior so 732 // Creating a second window of the same type should change the behavior so
730 // that a click does not change the activation state. 733 // that a click does not change the activation state.
731 AppWindow* window1a = CreateAppWindow(browser()->profile(), extension1); 734 AppWindow* window1a = CreateAppWindow(browser()->profile(), extension1);
732 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible()); 735 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible());
733 EXPECT_TRUE(window1a->GetBaseWindow()->IsActive()); 736 EXPECT_TRUE(window1a->GetBaseWindow()->IsActive());
734 // The first click does nothing. 737 // The first click does nothing.
735 item1_controller->ItemSelected(click_event); 738 item1_controller->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, display_id,
739 ash::LAUNCH_FROM_UNKNOWN);
736 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); 740 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible());
737 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible()); 741 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible());
738 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); 742 EXPECT_TRUE(window1->GetBaseWindow()->IsActive());
739 EXPECT_FALSE(window1a->GetBaseWindow()->IsActive()); 743 EXPECT_FALSE(window1a->GetBaseWindow()->IsActive());
740 // The second neither. 744 // The second neither.
741 item1_controller->ItemSelected(click_event); 745 item1_controller->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, display_id,
746 ash::LAUNCH_FROM_UNKNOWN);
742 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible()); 747 EXPECT_TRUE(window1->GetNativeWindow()->IsVisible());
743 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible()); 748 EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible());
744 EXPECT_TRUE(window1->GetBaseWindow()->IsActive()); 749 EXPECT_TRUE(window1->GetBaseWindow()->IsActive());
745 EXPECT_FALSE(window1a->GetBaseWindow()->IsActive()); 750 EXPECT_FALSE(window1a->GetBaseWindow()->IsActive());
746 } 751 }
747 752
748 // Confirm that ash::ShelfWindowWatcher correctly handles app panels. 753 // Confirm that ash::ShelfWindowWatcher correctly handles app panels.
749 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, AppPanel) { 754 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, AppPanel) {
750 // Enable experimental APIs to allow panel creation. 755 // Enable experimental APIs to allow panel creation.
751 base::CommandLine::ForCurrentProcess()->AppendSwitch( 756 base::CommandLine::ForCurrentProcess()->AppendSwitch(
(...skipping 11 matching lines...) Expand all
763 // Confirm that an item delegate was created and is in the correct state. 768 // Confirm that an item delegate was created and is in the correct state.
764 const ash::ShelfItem& item1 = GetLastLauncherPanelItem(); 769 const ash::ShelfItem& item1 = GetLastLauncherPanelItem();
765 EXPECT_EQ(ash::TYPE_APP_PANEL, item1.type); 770 EXPECT_EQ(ash::TYPE_APP_PANEL, item1.type);
766 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); 771 EXPECT_EQ(ash::STATUS_RUNNING, item1.status);
767 EXPECT_EQ(nullptr, GetItemController(item1.id)); 772 EXPECT_EQ(nullptr, GetItemController(item1.id));
768 ash::ShelfItemDelegate* item1_delegate = 773 ash::ShelfItemDelegate* item1_delegate =
769 shelf_model()->GetShelfItemDelegate(item1.id); 774 shelf_model()->GetShelfItemDelegate(item1.id);
770 EXPECT_EQ(ash::TYPE_APP_PANEL, 775 EXPECT_EQ(ash::TYPE_APP_PANEL,
771 panel->GetNativeWindow()->GetProperty(ash::kShelfItemTypeKey)); 776 panel->GetNativeWindow()->GetProperty(ash::kShelfItemTypeKey));
772 // Click the item and confirm that the panel is activated. 777 // Click the item and confirm that the panel is activated.
773 TestEvent click_event(ui::ET_MOUSE_PRESSED); 778 int64_t display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
774 item1_delegate->ItemSelected(click_event); 779 item1_delegate->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, display_id,
780 ash::LAUNCH_FROM_UNKNOWN);
775 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); 781 EXPECT_TRUE(panel->GetBaseWindow()->IsActive());
776 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); 782 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
777 // Click the item again and confirm that the panel is minimized. 783 // Click the item again and confirm that the panel is minimized.
778 item1_delegate->ItemSelected(click_event); 784 item1_delegate->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, display_id,
785 ash::LAUNCH_FROM_UNKNOWN);
779 EXPECT_TRUE(panel->GetBaseWindow()->IsMinimized()); 786 EXPECT_TRUE(panel->GetBaseWindow()->IsMinimized());
780 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); 787 EXPECT_EQ(ash::STATUS_RUNNING, item1.status);
781 // Click the item again and confirm that the panel is activated. 788 // Click the item again and confirm that the panel is activated.
782 item1_delegate->ItemSelected(click_event); 789 item1_delegate->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, display_id,
790 ash::LAUNCH_FROM_UNKNOWN);
783 EXPECT_TRUE(panel->GetNativeWindow()->IsVisible()); 791 EXPECT_TRUE(panel->GetNativeWindow()->IsVisible());
784 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); 792 EXPECT_TRUE(panel->GetBaseWindow()->IsActive());
785 EXPECT_FALSE(panel->GetBaseWindow()->IsMinimized()); 793 EXPECT_FALSE(panel->GetBaseWindow()->IsMinimized());
786 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); 794 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
787 } 795 }
788 796
789 // Confirm that click behavior for app panels is correct. 797 // Confirm that click behavior for app panels is correct.
790 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, AppPanelClickBehavior) { 798 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, AppPanelClickBehavior) {
791 // Enable experimental APIs to allow panel creation. 799 // Enable experimental APIs to allow panel creation.
792 base::CommandLine::ForCurrentProcess()->AppendSwitch( 800 base::CommandLine::ForCurrentProcess()->AppendSwitch(
(...skipping 11 matching lines...) Expand all
804 // Confirm that an item delegate was created and is in the correct state. 812 // Confirm that an item delegate was created and is in the correct state.
805 const ash::ShelfItem& item1 = GetLastLauncherPanelItem(); 813 const ash::ShelfItem& item1 = GetLastLauncherPanelItem();
806 EXPECT_EQ(ash::TYPE_APP_PANEL, item1.type); 814 EXPECT_EQ(ash::TYPE_APP_PANEL, item1.type);
807 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); 815 EXPECT_EQ(ash::STATUS_RUNNING, item1.status);
808 EXPECT_EQ(nullptr, GetItemController(item1.id)); 816 EXPECT_EQ(nullptr, GetItemController(item1.id));
809 ash::ShelfItemDelegate* item1_delegate = 817 ash::ShelfItemDelegate* item1_delegate =
810 shelf_model()->GetShelfItemDelegate(item1.id); 818 shelf_model()->GetShelfItemDelegate(item1.id);
811 EXPECT_EQ(ash::TYPE_APP_PANEL, 819 EXPECT_EQ(ash::TYPE_APP_PANEL,
812 panel->GetNativeWindow()->GetProperty(ash::kShelfItemTypeKey)); 820 panel->GetNativeWindow()->GetProperty(ash::kShelfItemTypeKey));
813 // Click the item and confirm that the panel is activated. 821 // Click the item and confirm that the panel is activated.
814 TestEvent click_event(ui::ET_MOUSE_PRESSED); 822 int64_t display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
815 item1_delegate->ItemSelected(click_event); 823 item1_delegate->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, display_id,
824 ash::LAUNCH_FROM_UNKNOWN);
816 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); 825 EXPECT_TRUE(panel->GetBaseWindow()->IsActive());
817 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); 826 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
818 // Click the item again and confirm that the panel is minimized. 827 // Click the item again and confirm that the panel is minimized.
819 item1_delegate->ItemSelected(click_event); 828 item1_delegate->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, display_id,
829 ash::LAUNCH_FROM_UNKNOWN);
820 EXPECT_TRUE(panel->GetBaseWindow()->IsMinimized()); 830 EXPECT_TRUE(panel->GetBaseWindow()->IsMinimized());
821 EXPECT_EQ(ash::STATUS_RUNNING, item1.status); 831 EXPECT_EQ(ash::STATUS_RUNNING, item1.status);
822 // Click the item again and confirm that the panel is activated. 832 // Click the item again and confirm that the panel is activated.
823 item1_delegate->ItemSelected(click_event); 833 item1_delegate->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, display_id,
834 ash::LAUNCH_FROM_UNKNOWN);
824 EXPECT_TRUE(panel->GetNativeWindow()->IsVisible()); 835 EXPECT_TRUE(panel->GetNativeWindow()->IsVisible());
825 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); 836 EXPECT_TRUE(panel->GetBaseWindow()->IsActive());
826 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status); 837 EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
827 } 838 }
828 839
829 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, BrowserActivation) { 840 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, BrowserActivation) {
830 int item_count = shelf_model()->item_count(); 841 int item_count = shelf_model()->item_count();
831 842
832 // First run app. 843 // First run app.
833 const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched"); 844 const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched");
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1518 shelf_model()->GetShelfItemDelegate(item.id); 1529 shelf_model()->GetShelfItemDelegate(item.id);
1519 EXPECT_NE(nullptr, shelf_item_delegate); 1530 EXPECT_NE(nullptr, shelf_item_delegate);
1520 EXPECT_EQ(ash::TYPE_APP_PANEL, item.type); 1531 EXPECT_EQ(ash::TYPE_APP_PANEL, item.type);
1521 EXPECT_EQ(ash::STATUS_RUNNING, item.status); 1532 EXPECT_EQ(ash::STATUS_RUNNING, item.status);
1522 1533
1523 // App windows should go to attention state. 1534 // App windows should go to attention state.
1524 panel->GetNativeWindow()->SetProperty(aura::client::kDrawAttentionKey, true); 1535 panel->GetNativeWindow()->SetProperty(aura::client::kDrawAttentionKey, true);
1525 EXPECT_EQ(ash::STATUS_ATTENTION, item.status); 1536 EXPECT_EQ(ash::STATUS_ATTENTION, item.status);
1526 1537
1527 // Click the item and confirm that the panel is activated. 1538 // Click the item and confirm that the panel is activated.
1528 TestEvent click_event(ui::ET_MOUSE_PRESSED); 1539 int64_t display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
1529 EXPECT_EQ(ash::ShelfItemDelegate::kExistingWindowActivated, 1540 EXPECT_EQ(
1530 shelf_item_delegate->ItemSelected(click_event)); 1541 ash::kExistingWindowActivated,
1542 shelf_item_delegate->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE,
1543 display_id, ash::LAUNCH_FROM_UNKNOWN));
1531 EXPECT_TRUE(panel->GetBaseWindow()->IsActive()); 1544 EXPECT_TRUE(panel->GetBaseWindow()->IsActive());
1532 EXPECT_EQ(ash::STATUS_ACTIVE, item.status); 1545 EXPECT_EQ(ash::STATUS_ACTIVE, item.status);
1533 1546
1534 // Active windows don't show attention. 1547 // Active windows don't show attention.
1535 panel->GetNativeWindow()->SetProperty(aura::client::kDrawAttentionKey, true); 1548 panel->GetNativeWindow()->SetProperty(aura::client::kDrawAttentionKey, true);
1536 EXPECT_EQ(ash::STATUS_ACTIVE, item.status); 1549 EXPECT_EQ(ash::STATUS_ACTIVE, item.status);
1537 } 1550 }
1538 1551
1539 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, 1552 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest,
1540 ShowInShelfWindowsWithWindowKeySet) { 1553 ShowInShelfWindowsWithWindowKeySet) {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1735 // Check that the LRU browser list does only contain the original browser. 1748 // Check that the LRU browser list does only contain the original browser.
1736 BrowserList* browser_list = BrowserList::GetInstance(); 1749 BrowserList* browser_list = BrowserList::GetInstance();
1737 BrowserList::const_reverse_iterator it = browser_list->begin_last_active(); 1750 BrowserList::const_reverse_iterator it = browser_list->begin_last_active();
1738 EXPECT_EQ(*it, browser()); 1751 EXPECT_EQ(*it, browser());
1739 ++it; 1752 ++it;
1740 EXPECT_EQ(it, browser_list->end_last_active()); 1753 EXPECT_EQ(it, browser_list->end_last_active());
1741 1754
1742 // Now request to either activate an existing app or create a new one. 1755 // Now request to either activate an existing app or create a new one.
1743 LauncherItemController* item_controller = 1756 LauncherItemController* item_controller =
1744 controller_->GetLauncherItemController(shortcut_id); 1757 controller_->GetLauncherItemController(shortcut_id);
1745 item_controller->ItemSelected(ui::KeyEvent(ui::ET_KEY_RELEASED, 1758 int64_t display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
1746 ui::VKEY_RETURN, 1759 item_controller->ItemSelected(ui::ET_KEY_RELEASED, ui::EF_NONE, display_id,
1747 ui::EF_NONE)); 1760 ash::LAUNCH_FROM_UNKNOWN);
1748 1761
1749 // Check that we have set focus on the existing application and nothing new 1762 // Check that we have set focus on the existing application and nothing new
1750 // was created. 1763 // was created.
1751 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); 1764 EXPECT_EQ(2u, chrome::GetTotalBrowserCount());
1752 EXPECT_EQ(tab_count1, tab_strip->count()); 1765 EXPECT_EQ(tab_count1, tab_strip->count());
1753 EXPECT_EQ(tab_count2, tab_strip2->count()); 1766 EXPECT_EQ(tab_count2, tab_strip2->count());
1754 EXPECT_EQ(chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow()), 1767 EXPECT_EQ(chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow()),
1755 browser2); 1768 browser2);
1756 } 1769 }
1757 1770
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
2121 controller_->GetBrowserShortcutLauncherItemController(); 2134 controller_->GetBrowserShortcutLauncherItemController();
2122 const ash::ShelfID id = item_controller->shelf_id(); 2135 const ash::ShelfID id = item_controller->shelf_id();
2123 EXPECT_NE(ash::kInvalidShelfID, id); 2136 EXPECT_NE(ash::kInvalidShelfID, id);
2124 2137
2125 // Get the number of browsers. 2138 // Get the number of browsers.
2126 size_t running_browser = chrome::GetTotalBrowserCount(); 2139 size_t running_browser = chrome::GetTotalBrowserCount();
2127 EXPECT_EQ(0u, running_browser); 2140 EXPECT_EQ(0u, running_browser);
2128 EXPECT_FALSE(controller_->IsOpen(id)); 2141 EXPECT_FALSE(controller_->IsOpen(id));
2129 2142
2130 // Activate. This creates new browser 2143 // Activate. This creates new browser
2131 item_controller->Activate(ash::LAUNCH_FROM_UNKNOWN); 2144 int64_t display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
2145 item_controller->ItemSelected(ui::ET_UNKNOWN, ui::EF_NONE, display_id,
2146 ash::LAUNCH_FROM_UNKNOWN);
2132 // New Window is created. 2147 // New Window is created.
2133 running_browser = chrome::GetTotalBrowserCount(); 2148 running_browser = chrome::GetTotalBrowserCount();
2134 EXPECT_EQ(1u, running_browser); 2149 EXPECT_EQ(1u, running_browser);
2135 EXPECT_TRUE(controller_->IsOpen(id)); 2150 EXPECT_TRUE(controller_->IsOpen(id));
2136 2151
2137 // Minimize Window. 2152 // Minimize Window.
2138 ash::wm::WindowState* window_state = ash::wm::GetActiveWindowState(); 2153 ash::wm::WindowState* window_state = ash::wm::GetActiveWindowState();
2139 window_state->Minimize(); 2154 window_state->Minimize();
2140 EXPECT_TRUE(window_state->IsMinimized()); 2155 EXPECT_TRUE(window_state->IsMinimized());
2141 2156
2142 // Activate again. This doesn't create new browser. 2157 // Activate again. This doesn't create new browser, it activates the window.
2143 // It activates window. 2158 item_controller->ItemSelected(ui::ET_UNKNOWN, ui::EF_NONE, display_id,
2144 item_controller->Activate(ash::LAUNCH_FROM_UNKNOWN); 2159 ash::LAUNCH_FROM_UNKNOWN);
2145 running_browser = chrome::GetTotalBrowserCount(); 2160 running_browser = chrome::GetTotalBrowserCount();
2146 EXPECT_EQ(1u, running_browser); 2161 EXPECT_EQ(1u, running_browser);
2147 EXPECT_TRUE(controller_->IsOpen(id)); 2162 EXPECT_TRUE(controller_->IsOpen(id));
2148 EXPECT_FALSE(window_state->IsMinimized()); 2163 EXPECT_FALSE(window_state->IsMinimized());
2149 } 2164 }
2150 2165
2151 // Check that the window's ShelfID property matches that of the active tab. 2166 // Check that the window's ShelfID property matches that of the active tab.
2152 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MatchingShelfIDandActiveTab) { 2167 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MatchingShelfIDandActiveTab) {
2153 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); 2168 EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
2154 EXPECT_EQ(1, browser()->tab_strip_model()->count()); 2169 EXPECT_EQ(1, browser()->tab_strip_model()->count());
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
2390 2405
2391 // Close all windows via the menu item. 2406 // Close all windows via the menu item.
2392 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); 2407 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE);
2393 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); 2408 EXPECT_EQ(0u, BrowserList::GetInstance()->size());
2394 2409
2395 // Check if "Close" is removed from the context menu. 2410 // Check if "Close" is removed from the context menu.
2396 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); 2411 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu();
2397 ASSERT_FALSE( 2412 ASSERT_FALSE(
2398 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); 2413 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE));
2399 } 2414 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698