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.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
6 | 6 |
7 #include "apps/shell_window.h" | 7 #include "apps/shell_window.h" |
8 #include "apps/shell_window_registry.h" | 8 #include "apps/shell_window_registry.h" |
9 #include "apps/ui/native_app_window.h" | 9 #include "apps/ui/native_app_window.h" |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
11 #include "ash/display/display_controller.h" | 11 #include "ash/display/display_controller.h" |
12 #include "ash/launcher/launcher.h" | 12 #include "ash/launcher/launcher.h" |
13 #include "ash/launcher/launcher_button.h" | 13 #include "ash/launcher/launcher_button.h" |
14 #include "ash/launcher/launcher_model.h" | 14 #include "ash/launcher/launcher_model.h" |
15 #include "ash/shelf/shelf_util.h" | 15 #include "ash/shelf/shelf_util.h" |
16 #include "ash/shelf/shelf_view.h" | 16 #include "ash/shelf/shelf_view.h" |
17 #include "ash/shell.h" | 17 #include "ash/shell.h" |
| 18 #include "ash/test/app_list_controller_test_api.h" |
18 #include "ash/test/launcher_test_api.h" | 19 #include "ash/test/launcher_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.h" | 22 #include "ash/wm/window_state.h" |
22 #include "ash/wm/window_util.h" | 23 #include "ash/wm/window_util.h" |
23 #include "base/strings/stringprintf.h" | 24 #include "base/strings/stringprintf.h" |
24 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" |
25 #include "chrome/browser/apps/app_browsertest_util.h" | 26 #include "chrome/browser/apps/app_browsertest_util.h" |
26 #include "chrome/browser/automation/automation_util.h" | 27 #include "chrome/browser/automation/automation_util.h" |
27 #include "chrome/browser/chrome_notification_types.h" | 28 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1556 // Open the app list menu and check that the drag and drop host was set. | 1557 // Open the app list menu and check that the drag and drop host was set. |
1557 gfx::Rect app_list_bounds = | 1558 gfx::Rect app_list_bounds = |
1558 test.shelf_view()->GetAppListButtonView()->GetBoundsInScreen(); | 1559 test.shelf_view()->GetAppListButtonView()->GetBoundsInScreen(); |
1559 generator.MoveMouseTo(app_list_bounds.CenterPoint().x(), | 1560 generator.MoveMouseTo(app_list_bounds.CenterPoint().x(), |
1560 app_list_bounds.CenterPoint().y()); | 1561 app_list_bounds.CenterPoint().y()); |
1561 base::MessageLoop::current()->RunUntilIdle(); | 1562 base::MessageLoop::current()->RunUntilIdle(); |
1562 generator.ClickLeftButton(); | 1563 generator.ClickLeftButton(); |
1563 | 1564 |
1564 EXPECT_TRUE(service->IsAppListVisible()); | 1565 EXPECT_TRUE(service->IsAppListVisible()); |
1565 app_list::AppsGridView* grid_view = | 1566 app_list::AppsGridView* grid_view = |
1566 app_list::AppsGridView::GetLastGridViewForTest(); | 1567 ash::test::AppListControllerTestApi(ash::Shell::GetInstance()). |
| 1568 GetRootGridView(); |
1567 ASSERT_TRUE(grid_view); | 1569 ASSERT_TRUE(grid_view); |
1568 ASSERT_TRUE(grid_view->has_drag_and_drop_host_for_test()); | 1570 ASSERT_TRUE(grid_view->has_drag_and_drop_host_for_test()); |
1569 | 1571 |
1570 // There should be 2 items in our application list. | 1572 // There should be 2 items in our application list. |
1571 const views::ViewModel* vm_grid = grid_view->view_model_for_test(); | 1573 const views::ViewModel* vm_grid = grid_view->view_model_for_test(); |
1572 EXPECT_EQ(2, vm_grid->view_size()); | 1574 EXPECT_EQ(2, vm_grid->view_size()); |
1573 | 1575 |
1574 // Test #1: Drag an app list which does not exist yet item into the | 1576 // Test #1: Drag an app list which does not exist yet item into the |
1575 // launcher. Keeping it dragged, see that a new item gets created. Continuing | 1577 // launcher. Keeping it dragged, see that a new item gets created. Continuing |
1576 // to drag it out should remove it again. | 1578 // to drag it out should remove it again. |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1772 // Open the app list menu and check that the drag and drop host was set. | 1774 // Open the app list menu and check that the drag and drop host was set. |
1773 gfx::Rect app_list_bounds = | 1775 gfx::Rect app_list_bounds = |
1774 test.shelf_view()->GetAppListButtonView()->GetBoundsInScreen(); | 1776 test.shelf_view()->GetAppListButtonView()->GetBoundsInScreen(); |
1775 generator.MoveMouseTo(app_list_bounds.CenterPoint().x(), | 1777 generator.MoveMouseTo(app_list_bounds.CenterPoint().x(), |
1776 app_list_bounds.CenterPoint().y()); | 1778 app_list_bounds.CenterPoint().y()); |
1777 generator.ClickLeftButton(); | 1779 generator.ClickLeftButton(); |
1778 base::MessageLoop::current()->RunUntilIdle(); | 1780 base::MessageLoop::current()->RunUntilIdle(); |
1779 | 1781 |
1780 EXPECT_TRUE(service->IsAppListVisible()); | 1782 EXPECT_TRUE(service->IsAppListVisible()); |
1781 app_list::AppsGridView* grid_view = | 1783 app_list::AppsGridView* grid_view = |
1782 app_list::AppsGridView::GetLastGridViewForTest(); | 1784 ash::test::AppListControllerTestApi(ash::Shell::GetInstance()). |
| 1785 GetRootGridView(); |
1783 ASSERT_TRUE(grid_view); | 1786 ASSERT_TRUE(grid_view); |
1784 const views::ViewModel* vm_grid = grid_view->view_model_for_test(); | 1787 const views::ViewModel* vm_grid = grid_view->view_model_for_test(); |
1785 EXPECT_EQ(2, vm_grid->view_size()); | 1788 EXPECT_EQ(2, vm_grid->view_size()); |
1786 gfx::Rect bounds_grid_1 = vm_grid->view_at(1)->GetBoundsInScreen(); | 1789 gfx::Rect bounds_grid_1 = vm_grid->view_at(1)->GetBoundsInScreen(); |
1787 // Test now that a click does create a new application tab. | 1790 // Test now that a click does create a new application tab. |
1788 TabStripModel* tab_strip = browser()->tab_strip_model(); | 1791 TabStripModel* tab_strip = browser()->tab_strip_model(); |
1789 int tab_count = tab_strip->count(); | 1792 int tab_count = tab_strip->count(); |
1790 generator.MoveMouseTo(bounds_grid_1.CenterPoint().x(), | 1793 generator.MoveMouseTo(bounds_grid_1.CenterPoint().x(), |
1791 bounds_grid_1.CenterPoint().y()); | 1794 bounds_grid_1.CenterPoint().y()); |
1792 generator.ClickLeftButton(); | 1795 generator.ClickLeftButton(); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1878 // Now show overflow bubble. | 1881 // Now show overflow bubble. |
1879 test.ShowOverflowBubble(); | 1882 test.ShowOverflowBubble(); |
1880 EXPECT_TRUE(launcher_->IsShowingOverflowBubble()); | 1883 EXPECT_TRUE(launcher_->IsShowingOverflowBubble()); |
1881 | 1884 |
1882 // Unpin first pinned app and there should be no crash. | 1885 // Unpin first pinned app and there should be no crash. |
1883 controller_->UnpinAppWithID(std::string("fake_app_0")); | 1886 controller_->UnpinAppWithID(std::string("fake_app_0")); |
1884 | 1887 |
1885 test.RunMessageLoopUntilAnimationsDone(); | 1888 test.RunMessageLoopUntilAnimationsDone(); |
1886 EXPECT_FALSE(launcher_->IsShowingOverflowBubble()); | 1889 EXPECT_FALSE(launcher_->IsShowingOverflowBubble()); |
1887 } | 1890 } |
OLD | NEW |