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