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