| 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/aura/wm_window_aura.h" | 9 #include "ash/aura/wm_window_aura.h" |
| 10 #include "ash/common/shelf/app_list_button.h" | 10 #include "ash/common/shelf/app_list_button.h" |
| (...skipping 2081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2092 generator.ClickLeftButton(); | 2092 generator.ClickLeftButton(); |
| 2093 base::RunLoop().RunUntilIdle(); | 2093 base::RunLoop().RunUntilIdle(); |
| 2094 EXPECT_EQ(tab_count + 1, tab_strip->count()); | 2094 EXPECT_EQ(tab_count + 1, tab_strip->count()); |
| 2095 } | 2095 } |
| 2096 | 2096 |
| 2097 // Check LauncherItemController of Browser Shortcut functionality. | 2097 // Check LauncherItemController of Browser Shortcut functionality. |
| 2098 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTestNoDefaultBrowser, | 2098 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTestNoDefaultBrowser, |
| 2099 BrowserShortcutLauncherItemController) { | 2099 BrowserShortcutLauncherItemController) { |
| 2100 LauncherItemController* item_controller = | 2100 LauncherItemController* item_controller = |
| 2101 controller_->GetBrowserShortcutLauncherItemController(); | 2101 controller_->GetBrowserShortcutLauncherItemController(); |
| 2102 const ash::ShelfID id = item_controller->shelf_id(); |
| 2103 EXPECT_NE(ash::kInvalidShelfID, id); |
| 2102 | 2104 |
| 2103 // Get the number of browsers. | 2105 // Get the number of browsers. |
| 2104 size_t running_browser = chrome::GetTotalBrowserCount(); | 2106 size_t running_browser = chrome::GetTotalBrowserCount(); |
| 2105 EXPECT_EQ(0u, running_browser); | 2107 EXPECT_EQ(0u, running_browser); |
| 2106 EXPECT_FALSE(item_controller->IsOpen()); | 2108 EXPECT_FALSE(controller_->IsOpen(id)); |
| 2107 | 2109 |
| 2108 // Activate. This creates new browser | 2110 // Activate. This creates new browser |
| 2109 item_controller->Activate(ash::LAUNCH_FROM_UNKNOWN); | 2111 item_controller->Activate(ash::LAUNCH_FROM_UNKNOWN); |
| 2110 // New Window is created. | 2112 // New Window is created. |
| 2111 running_browser = chrome::GetTotalBrowserCount(); | 2113 running_browser = chrome::GetTotalBrowserCount(); |
| 2112 EXPECT_EQ(1u, running_browser); | 2114 EXPECT_EQ(1u, running_browser); |
| 2113 EXPECT_TRUE(item_controller->IsOpen()); | 2115 EXPECT_TRUE(controller_->IsOpen(id)); |
| 2114 | 2116 |
| 2115 // Minimize Window. | 2117 // Minimize Window. |
| 2116 ash::wm::WindowState* window_state = ash::wm::GetActiveWindowState(); | 2118 ash::wm::WindowState* window_state = ash::wm::GetActiveWindowState(); |
| 2117 window_state->Minimize(); | 2119 window_state->Minimize(); |
| 2118 EXPECT_TRUE(window_state->IsMinimized()); | 2120 EXPECT_TRUE(window_state->IsMinimized()); |
| 2119 | 2121 |
| 2120 // Activate again. This doesn't create new browser. | 2122 // Activate again. This doesn't create new browser. |
| 2121 // It activates window. | 2123 // It activates window. |
| 2122 item_controller->Activate(ash::LAUNCH_FROM_UNKNOWN); | 2124 item_controller->Activate(ash::LAUNCH_FROM_UNKNOWN); |
| 2123 running_browser = chrome::GetTotalBrowserCount(); | 2125 running_browser = chrome::GetTotalBrowserCount(); |
| 2124 EXPECT_EQ(1u, running_browser); | 2126 EXPECT_EQ(1u, running_browser); |
| 2125 EXPECT_TRUE(item_controller->IsOpen()); | 2127 EXPECT_TRUE(controller_->IsOpen(id)); |
| 2126 EXPECT_FALSE(window_state->IsMinimized()); | 2128 EXPECT_FALSE(window_state->IsMinimized()); |
| 2127 } | 2129 } |
| 2128 | 2130 |
| 2129 // Check that the window's ShelfID property matches that of the active tab. | 2131 // Check that the window's ShelfID property matches that of the active tab. |
| 2130 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MatchingShelfIDandActiveTab) { | 2132 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MatchingShelfIDandActiveTab) { |
| 2131 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 2133 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
| 2132 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 2134 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
| 2133 EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); | 2135 EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); |
| 2134 EXPECT_EQ(2, model_->item_count()); | 2136 EXPECT_EQ(2, model_->item_count()); |
| 2135 | 2137 |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2368 | 2370 |
| 2369 // Close all windows via the menu item. | 2371 // Close all windows via the menu item. |
| 2370 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); | 2372 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); |
| 2371 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); | 2373 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); |
| 2372 | 2374 |
| 2373 // Check if "Close" is removed from the context menu. | 2375 // Check if "Close" is removed from the context menu. |
| 2374 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); | 2376 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); |
| 2375 ASSERT_FALSE( | 2377 ASSERT_FALSE( |
| 2376 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); | 2378 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); |
| 2377 } | 2379 } |
| OLD | NEW |