| 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/ash_switches.h" | 10 #include "ash/common/ash_switches.h" |
| 11 #include "ash/common/shelf/app_list_button.h" | 11 #include "ash/common/shelf/app_list_button.h" |
| 12 #include "ash/common/shelf/shelf_button.h" | 12 #include "ash/common/shelf/shelf_button.h" |
| 13 #include "ash/common/shelf/shelf_constants.h" | 13 #include "ash/common/shelf/shelf_constants.h" |
| 14 #include "ash/common/shelf/shelf_model.h" | 14 #include "ash/common/shelf/shelf_model.h" |
| 15 #include "ash/common/shelf/shelf_view.h" | 15 #include "ash/common/shelf/shelf_view.h" |
| 16 #include "ash/common/wm/window_state.h" | 16 #include "ash/common/wm/window_state.h" |
| 17 #include "ash/common/wm_shell.h" | 17 #include "ash/common/wm_shell.h" |
| 18 #include "ash/shelf/shelf.h" | 18 #include "ash/shelf/shelf.h" |
| 19 #include "ash/shelf/shelf_util.h" | 19 #include "ash/shelf/shelf_util.h" |
| 20 #include "ash/shelf/shelf_widget.h" |
| 20 #include "ash/shell.h" | 21 #include "ash/shell.h" |
| 21 #include "ash/test/shelf_test_api.h" | 22 #include "ash/test/shelf_test_api.h" |
| 22 #include "ash/test/shelf_view_test_api.h" | 23 #include "ash/test/shelf_view_test_api.h" |
| 23 #include "ash/wm/window_state_aura.h" | 24 #include "ash/wm/window_state_aura.h" |
| 24 #include "ash/wm/window_util.h" | 25 #include "ash/wm/window_util.h" |
| 25 #include "base/macros.h" | 26 #include "base/macros.h" |
| 26 #include "base/run_loop.h" | 27 #include "base/run_loop.h" |
| 27 #include "base/strings/stringprintf.h" | 28 #include "base/strings/stringprintf.h" |
| 28 #include "base/strings/utf_string_conversions.h" | 29 #include "base/strings/utf_string_conversions.h" |
| 29 #include "build/build_config.h" | 30 #include "build/build_config.h" |
| (...skipping 2160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2190 browser()->tab_strip_model()->ActivateTabAt(0, false); | 2191 browser()->tab_strip_model()->ActivateTabAt(0, false); |
| 2191 EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); | 2192 EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); |
| 2192 EXPECT_EQ(browser_id, ash::GetShelfIDForWindow(window)); | 2193 EXPECT_EQ(browser_id, ash::GetShelfIDForWindow(window)); |
| 2193 } | 2194 } |
| 2194 | 2195 |
| 2195 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, OverflowBubble) { | 2196 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, OverflowBubble) { |
| 2196 // Make sure to have a browser window | 2197 // Make sure to have a browser window |
| 2197 chrome::NewTab(browser()); | 2198 chrome::NewTab(browser()); |
| 2198 | 2199 |
| 2199 // No overflow yet. | 2200 // No overflow yet. |
| 2200 EXPECT_FALSE(shelf_->IsShowingOverflowBubble()); | 2201 EXPECT_FALSE(shelf_->shelf_widget()->IsShowingOverflowBubble()); |
| 2201 | 2202 |
| 2202 ash::test::ShelfViewTestAPI test( | 2203 ash::test::ShelfViewTestAPI test( |
| 2203 ash::test::ShelfTestAPI(shelf_).shelf_view()); | 2204 ash::test::ShelfTestAPI(shelf_).shelf_view()); |
| 2204 | 2205 |
| 2205 int items_added = 0; | 2206 int items_added = 0; |
| 2206 while (!test.IsOverflowButtonVisible()) { | 2207 while (!test.IsOverflowButtonVisible()) { |
| 2207 std::string fake_app_id = base::StringPrintf("fake_app_%d", items_added); | 2208 std::string fake_app_id = base::StringPrintf("fake_app_%d", items_added); |
| 2208 PinFakeApp(fake_app_id); | 2209 PinFakeApp(fake_app_id); |
| 2209 | 2210 |
| 2210 ++items_added; | 2211 ++items_added; |
| 2211 ASSERT_LT(items_added, 10000); | 2212 ASSERT_LT(items_added, 10000); |
| 2212 } | 2213 } |
| 2213 | 2214 |
| 2214 // Now show overflow bubble. | 2215 // Now show overflow bubble. |
| 2215 test.ShowOverflowBubble(); | 2216 test.ShowOverflowBubble(); |
| 2216 EXPECT_TRUE(shelf_->IsShowingOverflowBubble()); | 2217 EXPECT_TRUE(shelf_->shelf_widget()->IsShowingOverflowBubble()); |
| 2217 | 2218 |
| 2218 // Unpin first pinned app and there should be no crash. | 2219 // Unpin first pinned app and there should be no crash. |
| 2219 controller_->UnpinAppWithID(std::string("fake_app_0")); | 2220 controller_->UnpinAppWithID(std::string("fake_app_0")); |
| 2220 | 2221 |
| 2221 test.RunMessageLoopUntilAnimationsDone(); | 2222 test.RunMessageLoopUntilAnimationsDone(); |
| 2222 EXPECT_FALSE(shelf_->IsShowingOverflowBubble()); | 2223 EXPECT_FALSE(shelf_->shelf_widget()->IsShowingOverflowBubble()); |
| 2223 } | 2224 } |
| 2224 | 2225 |
| 2225 // Check that a windowed V1 application can navigate away from its domain, but | 2226 // Check that a windowed V1 application can navigate away from its domain, but |
| 2226 // still gets detected properly. | 2227 // still gets detected properly. |
| 2227 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, V1AppNavigation) { | 2228 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, V1AppNavigation) { |
| 2228 // We assume that the web store is always there (which it apparently is). | 2229 // We assume that the web store is always there (which it apparently is). |
| 2229 controller_->PinAppWithID(extensions::kWebStoreAppId); | 2230 controller_->PinAppWithID(extensions::kWebStoreAppId); |
| 2230 ash::ShelfID id = controller_->GetShelfIDForAppID( | 2231 ash::ShelfID id = controller_->GetShelfIDForAppID( |
| 2231 extensions::kWebStoreAppId); | 2232 extensions::kWebStoreAppId); |
| 2232 ASSERT_NE(0, id); | 2233 ASSERT_NE(0, id); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2403 | 2404 |
| 2404 // Close all windows via the menu item. | 2405 // Close all windows via the menu item. |
| 2405 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); | 2406 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); |
| 2406 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); | 2407 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); |
| 2407 | 2408 |
| 2408 // Check if "Close" is removed from the context menu. | 2409 // Check if "Close" is removed from the context menu. |
| 2409 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); | 2410 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); |
| 2410 ASSERT_FALSE( | 2411 ASSERT_FALSE( |
| 2411 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); | 2412 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); |
| 2412 } | 2413 } |
| OLD | NEW |