| Index: chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
|
| diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
|
| index cd53877ca532c87cd973eaca2903aa552a889d6b..0e10d377bb3d1eb400ea51798fdfc772b49b996b 100644
|
| --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
|
| +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
|
| @@ -56,8 +56,11 @@
|
| #include "extensions/common/switches.h"
|
| #include "extensions/test/extension_test_message_listener.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| +#include "ui/app_list/app_list_switches.h"
|
| #include "ui/app_list/views/app_list_item_view.h"
|
| #include "ui/app_list/views/apps_grid_view.h"
|
| +#include "ui/app_list/views/start_page_view.h"
|
| +#include "ui/app_list/views/tile_item_view.h"
|
| #include "ui/aura/client/aura_constants.h"
|
| #include "ui/aura/window.h"
|
| #include "ui/events/event.h"
|
| @@ -107,6 +110,33 @@ class TestAppWindowRegistryObserver
|
| DISALLOW_COPY_AND_ASSIGN(TestAppWindowRegistryObserver);
|
| };
|
|
|
| +// Click the "All Apps" button from the app launcher start page. Assumes that
|
| +// the app launcher is open to the start page. On the non-experimental launcher,
|
| +// does nothing.
|
| +// |display_origin| is the top-left corner of the active display, in screen
|
| +// coordinates.
|
| +void ClickAllAppsButtonFromStartPage(ui::test::EventGenerator* generator,
|
| + const gfx::Point& display_origin) {
|
| + if (!app_list::switches::IsExperimentalAppListEnabled())
|
| + return;
|
| +
|
| + ash::test::AppListControllerTestApi controller_test(
|
| + ash::Shell::GetInstance());
|
| +
|
| + app_list::StartPageView* start_page_view = controller_test.GetStartPageView();
|
| + DCHECK(start_page_view);
|
| +
|
| + app_list::TileItemView* all_apps_button = start_page_view->all_apps_button();
|
| + gfx::Rect all_apps_rect = all_apps_button->GetBoundsInScreen();
|
| + all_apps_rect.Offset(-display_origin.x(), -display_origin.y());
|
| + generator->MoveMouseTo(all_apps_rect.CenterPoint().x(),
|
| + all_apps_rect.CenterPoint().y());
|
| + generator->ClickLeftButton();
|
| + base::MessageLoop::current()->RunUntilIdle();
|
| + // Run Layout() to effectively complete the animation to the apps page.
|
| + controller_test.LayoutContentsView();
|
| +}
|
| +
|
| } // namespace
|
|
|
| class LauncherPlatformAppBrowserTest
|
| @@ -1738,7 +1768,7 @@ class ShelfAppBrowserTestWithMultiMonitor
|
| virtual void SetUpCommandLine(CommandLine* command_line) override {
|
| ShelfAppBrowserTestNoDefaultBrowser::SetUpCommandLine(command_line);
|
| command_line->AppendSwitchASCII("ash-host-window-bounds",
|
| - "800x600,801+0-800x600");
|
| + "800x800,801+0-800x800");
|
| }
|
|
|
| private:
|
| @@ -1774,10 +1804,14 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTestWithMultiMonitor,
|
|
|
| generator.MoveMouseTo(app_list_bounds.CenterPoint().x(),
|
| app_list_bounds.CenterPoint().y());
|
| - base::MessageLoop::current()->RunUntilIdle();
|
| generator.ClickLeftButton();
|
| + base::MessageLoop::current()->RunUntilIdle();
|
| + EXPECT_TRUE(service->IsAppListVisible());
|
|
|
| + // Click the "all apps" button on the start page.
|
| + ClickAllAppsButtonFromStartPage(&generator, origin);
|
| EXPECT_TRUE(service->IsAppListVisible());
|
| +
|
| app_list::AppsGridView* grid_view =
|
| ash::test::AppListControllerTestApi(ash::Shell::GetInstance()).
|
| GetRootGridView();
|
| @@ -1819,7 +1853,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTestWithMultiMonitor,
|
|
|
| // Move it to an empty slot on grid_view.
|
| gfx::Rect empty_slot_rect = bounds_grid_1;
|
| - empty_slot_rect.Offset(0, bounds_grid_1.height());
|
| + empty_slot_rect.Offset(0, grid_view->GetTotalTileSize().height());
|
| generator.MoveMouseTo(empty_slot_rect.CenterPoint().x(),
|
| empty_slot_rect.CenterPoint().y());
|
| base::MessageLoop::current()->RunUntilIdle();
|
| @@ -1954,8 +1988,13 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, ClickItem) {
|
| app_list_bounds.CenterPoint().y());
|
| generator.ClickLeftButton();
|
| base::MessageLoop::current()->RunUntilIdle();
|
| + EXPECT_TRUE(service->IsAppListVisible());
|
|
|
| + // Click the "all apps" button on the start page.
|
| + ClickAllAppsButtonFromStartPage(&generator, gfx::Point());
|
| EXPECT_TRUE(service->IsAppListVisible());
|
| +
|
| + // Click an app icon in the app grid view.
|
| app_list::AppsGridView* grid_view =
|
| ash::test::AppListControllerTestApi(ash::Shell::GetInstance()).
|
| GetRootGridView();
|
|
|