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/ash_switches.h" | 9 #include "ash/common/ash_switches.h" |
10 #include "ash/common/shelf/shelf_constants.h" | 10 #include "ash/common/shelf/shelf_constants.h" |
11 #include "ash/common/shelf/shelf_model.h" | 11 #include "ash/common/shelf/shelf_model.h" |
12 #include "ash/common/wm/window_state.h" | 12 #include "ash/common/wm/window_state.h" |
| 13 #include "ash/shelf/app_list_button.h" |
13 #include "ash/shelf/shelf.h" | 14 #include "ash/shelf/shelf.h" |
14 #include "ash/shelf/shelf_button.h" | 15 #include "ash/shelf/shelf_button.h" |
15 #include "ash/shelf/shelf_util.h" | 16 #include "ash/shelf/shelf_util.h" |
16 #include "ash/shelf/shelf_view.h" | 17 #include "ash/shelf/shelf_view.h" |
17 #include "ash/shell.h" | 18 #include "ash/shell.h" |
18 #include "ash/test/shelf_test_api.h" | 19 #include "ash/test/shelf_test_api.h" |
19 #include "ash/test/shelf_view_test_api.h" | 20 #include "ash/test/shelf_view_test_api.h" |
20 #include "ash/test/shell_test_api.h" | 21 #include "ash/test/shell_test_api.h" |
21 #include "ash/wm/window_state_aura.h" | 22 #include "ash/wm/window_state_aura.h" |
22 #include "ash/wm/window_util.h" | 23 #include "ash/wm/window_util.h" |
(...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1650 ash::test::ShelfViewTestAPI test( | 1651 ash::test::ShelfViewTestAPI test( |
1651 ash::test::ShelfTestAPI(shelf_).shelf_view()); | 1652 ash::test::ShelfTestAPI(shelf_).shelf_view()); |
1652 AppListService* service = AppListService::Get(); | 1653 AppListService* service = AppListService::Get(); |
1653 | 1654 |
1654 // There should be two items in our launcher by this time. | 1655 // There should be two items in our launcher by this time. |
1655 EXPECT_EQ(2, model_->item_count()); | 1656 EXPECT_EQ(2, model_->item_count()); |
1656 EXPECT_FALSE(service->IsAppListVisible()); | 1657 EXPECT_FALSE(service->IsAppListVisible()); |
1657 | 1658 |
1658 // Open the app list menu and check that the drag and drop host was set. | 1659 // Open the app list menu and check that the drag and drop host was set. |
1659 gfx::Rect app_list_bounds = | 1660 gfx::Rect app_list_bounds = |
1660 test.shelf_view()->GetAppListButtonView()->GetBoundsInScreen(); | 1661 test.shelf_view()->GetAppListButton()->GetBoundsInScreen(); |
1661 generator.MoveMouseTo(app_list_bounds.CenterPoint().x(), | 1662 generator.MoveMouseTo(app_list_bounds.CenterPoint().x(), |
1662 app_list_bounds.CenterPoint().y()); | 1663 app_list_bounds.CenterPoint().y()); |
1663 base::RunLoop().RunUntilIdle(); | 1664 base::RunLoop().RunUntilIdle(); |
1664 generator.ClickLeftButton(); | 1665 generator.ClickLeftButton(); |
1665 | 1666 |
1666 EXPECT_TRUE(service->IsAppListVisible()); | 1667 EXPECT_TRUE(service->IsAppListVisible()); |
1667 app_list::AppsGridView* grid_view = | 1668 app_list::AppsGridView* grid_view = |
1668 AppListServiceAshTestApi().GetRootGridView(); | 1669 AppListServiceAshTestApi().GetRootGridView(); |
1669 ASSERT_TRUE(grid_view); | 1670 ASSERT_TRUE(grid_view); |
1670 ASSERT_TRUE(grid_view->has_drag_and_drop_host_for_test()); | 1671 ASSERT_TRUE(grid_view->has_drag_and_drop_host_for_test()); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1794 ash::test::ShelfViewTestAPI test( | 1795 ash::test::ShelfViewTestAPI test( |
1795 ash::test::ShelfTestAPI(secondary_shelf).shelf_view()); | 1796 ash::test::ShelfTestAPI(secondary_shelf).shelf_view()); |
1796 AppListService* service = AppListService::Get(); | 1797 AppListService* service = AppListService::Get(); |
1797 | 1798 |
1798 // There should be two items in our shelf by this time. | 1799 // There should be two items in our shelf by this time. |
1799 EXPECT_EQ(2, model_->item_count()); | 1800 EXPECT_EQ(2, model_->item_count()); |
1800 EXPECT_FALSE(service->IsAppListVisible()); | 1801 EXPECT_FALSE(service->IsAppListVisible()); |
1801 | 1802 |
1802 // Open the app list menu and check that the drag and drop host was set. | 1803 // Open the app list menu and check that the drag and drop host was set. |
1803 gfx::Rect app_list_bounds = | 1804 gfx::Rect app_list_bounds = |
1804 test.shelf_view()->GetAppListButtonView()->GetBoundsInScreen(); | 1805 test.shelf_view()->GetAppListButton()->GetBoundsInScreen(); |
1805 display::Display display = | 1806 display::Display display = |
1806 display::Screen::GetScreen()->GetDisplayNearestWindow( | 1807 display::Screen::GetScreen()->GetDisplayNearestWindow( |
1807 secondary_root_window); | 1808 secondary_root_window); |
1808 const gfx::Point& origin = display.bounds().origin(); | 1809 const gfx::Point& origin = display.bounds().origin(); |
1809 app_list_bounds.Offset(-origin.x(), -origin.y()); | 1810 app_list_bounds.Offset(-origin.x(), -origin.y()); |
1810 | 1811 |
1811 generator.MoveMouseTo(app_list_bounds.CenterPoint().x(), | 1812 generator.MoveMouseTo(app_list_bounds.CenterPoint().x(), |
1812 app_list_bounds.CenterPoint().y()); | 1813 app_list_bounds.CenterPoint().y()); |
1813 generator.ClickLeftButton(); | 1814 generator.ClickLeftButton(); |
1814 base::RunLoop().RunUntilIdle(); | 1815 base::RunLoop().RunUntilIdle(); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1981 gfx::Point()); | 1982 gfx::Point()); |
1982 ash::test::ShelfViewTestAPI test( | 1983 ash::test::ShelfViewTestAPI test( |
1983 ash::test::ShelfTestAPI(shelf_).shelf_view()); | 1984 ash::test::ShelfTestAPI(shelf_).shelf_view()); |
1984 AppListService* service = AppListService::Get(); | 1985 AppListService* service = AppListService::Get(); |
1985 // There should be two items in our shelf by this time. | 1986 // There should be two items in our shelf by this time. |
1986 EXPECT_EQ(2, model_->item_count()); | 1987 EXPECT_EQ(2, model_->item_count()); |
1987 EXPECT_FALSE(service->IsAppListVisible()); | 1988 EXPECT_FALSE(service->IsAppListVisible()); |
1988 | 1989 |
1989 // Open the app list menu and check that the drag and drop host was set. | 1990 // Open the app list menu and check that the drag and drop host was set. |
1990 gfx::Rect app_list_bounds = | 1991 gfx::Rect app_list_bounds = |
1991 test.shelf_view()->GetAppListButtonView()->GetBoundsInScreen(); | 1992 test.shelf_view()->GetAppListButton()->GetBoundsInScreen(); |
1992 generator.MoveMouseTo(app_list_bounds.CenterPoint().x(), | 1993 generator.MoveMouseTo(app_list_bounds.CenterPoint().x(), |
1993 app_list_bounds.CenterPoint().y()); | 1994 app_list_bounds.CenterPoint().y()); |
1994 generator.ClickLeftButton(); | 1995 generator.ClickLeftButton(); |
1995 base::RunLoop().RunUntilIdle(); | 1996 base::RunLoop().RunUntilIdle(); |
1996 EXPECT_TRUE(service->IsAppListVisible()); | 1997 EXPECT_TRUE(service->IsAppListVisible()); |
1997 | 1998 |
1998 // Click the "all apps" button on the start page. | 1999 // Click the "all apps" button on the start page. |
1999 ClickAllAppsButtonFromStartPage(&generator, gfx::Point()); | 2000 ClickAllAppsButtonFromStartPage(&generator, gfx::Point()); |
2000 EXPECT_TRUE(service->IsAppListVisible()); | 2001 EXPECT_TRUE(service->IsAppListVisible()); |
2001 | 2002 |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2296 // Close all windows. | 2297 // Close all windows. |
2297 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); | 2298 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); |
2298 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); | 2299 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); |
2299 | 2300 |
2300 // Check if "Close" is removed from the context menu. | 2301 // Check if "Close" is removed from the context menu. |
2301 std::unique_ptr<LauncherContextMenu> menu2 = | 2302 std::unique_ptr<LauncherContextMenu> menu2 = |
2302 CreateLauncherContextMenu(ash::TYPE_BROWSER_SHORTCUT); | 2303 CreateLauncherContextMenu(ash::TYPE_BROWSER_SHORTCUT); |
2303 ASSERT_FALSE( | 2304 ASSERT_FALSE( |
2304 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); | 2305 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); |
2305 } | 2306 } |
OLD | NEW |