Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(328)

Unified Diff: chrome/browser/ui/ash/app_list/app_list_interactive_uitest.cc

Issue 2576913002: Use mojo app list interfaces for mash and classic ash. (Closed)
Patch Set: Sync and rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/ash/app_list/app_list_interactive_uitest.cc
diff --git a/chrome/browser/ui/ash/app_list/app_list_interactive_uitest.cc b/chrome/browser/ui/ash/app_list/app_list_interactive_uitest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a4386b1f02808cdb64ee887a1cde4c7057158b64
--- /dev/null
+++ b/chrome/browser/ui/ash/app_list/app_list_interactive_uitest.cc
@@ -0,0 +1,50 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <memory>
+
+#include "ash/common/shelf/app_list_button.h"
+#include "ash/common/shelf/shelf_widget.h"
+#include "ash/common/shelf/wm_shelf.h"
+#include "ash/common/wm_shell.h"
+#include "ash/common/wm_window.h"
+#include "ash/public/cpp/shell_window_ids.h"
+#include "base/run_loop.h"
+#include "chrome/test/base/in_process_browser_test.h"
+#include "ui/app_list/presenter/app_list.h"
+#include "ui/events/test/event_generator.h"
+
+using AppListTest = InProcessBrowserTest;
+
+// An integration test to toggle the app list by pressing the shelf button.
+IN_PROC_BROWSER_TEST_F(AppListTest, PressAppListButtonToShowAndDismiss) {
+ ash::WmShell* shell = ash::WmShell::Get();
+ ash::WmShelf* shelf = ash::WmShelf::ForWindow(shell->GetActiveWindow());
+ ash::ShelfWidget* shelf_widget = shelf->shelf_widget();
+ ash::AppListButton* app_list_button = shelf_widget->GetAppListButton();
+
+ ash::WmWindow* root_window = shell->GetActiveWindow()->GetRootWindow();
+ ash::WmWindow* app_list_container = root_window->GetChildByShellWindowId(
+ ash::kShellWindowId_AppListContainer);
+ ui::test::EventGenerator generator(shelf_widget->GetNativeWindow());
+
+ // Click the app list button to show the app list.
+ EXPECT_FALSE(shell->app_list()->GetTargetVisibility());
+ EXPECT_EQ(0u, app_list_container->GetChildren().size());
+ EXPECT_FALSE(app_list_button->is_showing_app_list());
+ generator.set_current_location(
+ app_list_button->GetBoundsInScreen().CenterPoint());
+ generator.ClickLeftButton();
+ base::RunLoop().RunUntilIdle();
+ EXPECT_TRUE(shell->app_list()->GetTargetVisibility());
+ EXPECT_EQ(1u, app_list_container->GetChildren().size());
+ EXPECT_TRUE(app_list_button->is_showing_app_list());
+
+ // Click the button again to dismiss the app list; the window animates closed.
+ generator.ClickLeftButton();
+ base::RunLoop().RunUntilIdle();
+ EXPECT_FALSE(shell->app_list()->GetTargetVisibility());
+ EXPECT_EQ(1u, app_list_container->GetChildren().size());
+ EXPECT_FALSE(app_list_button->is_showing_app_list());
+}

Powered by Google App Engine
This is Rietveld 408576698