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

Unified Diff: ash/launcher/launcher_unittest.cc

Issue 13993027: ash: Update app list button. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for #1 Created 7 years, 8 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
« no previous file with comments | « ash/launcher/app_list_button.cc ('k') | ash/launcher/launcher_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/launcher/launcher_unittest.cc
diff --git a/ash/launcher/launcher_unittest.cc b/ash/launcher/launcher_unittest.cc
index 59d6a67e7092777d5364d823de7b06cf6d47720b..06b77ba7d6e0d796322428bfffdff90d0b43f18e 100644
--- a/ash/launcher/launcher_unittest.cc
+++ b/ash/launcher/launcher_unittest.cc
@@ -3,10 +3,13 @@
// found in the LICENSE file.
#include "ash/launcher/launcher.h"
+
+#include <vector>
+
+#include "ash/launcher/app_list_button.h"
#include "ash/launcher/launcher_button.h"
#include "ash/launcher/launcher_model.h"
#include "ash/launcher/launcher_view.h"
-
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
@@ -24,6 +27,7 @@
#endif
typedef ash::test::AshTestBase LauncherTest;
+using ash::internal::AppListButton;
using ash::internal::LauncherView;
using ash::internal::LauncherButton;
@@ -57,7 +61,7 @@ TEST_F(LauncherTest, OpenBrowser) {
// Confirm that using the menu will clear the hover attribute. To avoid another
// browser test we check this here.
-TEST_F(LauncherTest, checkHoverAfterMenu) {
+TEST_F(LauncherTest, CheckHoverAfterMenu) {
Launcher* launcher = Launcher::ForPrimaryDisplay();
ASSERT_TRUE(launcher);
LauncherView* launcher_view = launcher->GetLauncherViewForTest();
@@ -116,4 +120,50 @@ TEST_F(LauncherTest, ShowOverflowBubble) {
EXPECT_FALSE(launcher->IsShowingOverflowBubble());
}
+// Tests app list button toggles when app list UI shows up.
+TEST_F(LauncherTest, AppMenuToggle) {
+ AppListButton* app_list_button = static_cast<AppListButton*>(
+ Launcher::ForPrimaryDisplay()->GetLauncherViewForTest()->
+ GetAppListButtonView());
+ Shell* shell = Shell::GetInstance();
+
+ EXPECT_FALSE(shell->GetAppListTargetVisibility());
+ EXPECT_FALSE(app_list_button->toggled());
+ shell->ToggleAppList(NULL);
+ EXPECT_TRUE(shell->GetAppListTargetVisibility());
+ EXPECT_TRUE(app_list_button->toggled());
+}
+
+// Tests only the app list button with a UI is toggled.
+TEST_F(LauncherTest, MultipleAppMenuToggle) {
+ UpdateDisplay("300x300,200x200");
+
+ std::vector<AppListButton*> app_list_buttons;
+ Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
+ for (Shell::RootWindowList::const_iterator it = root_windows.begin();
+ it != root_windows.end(); ++it) {
+ AppListButton* button = static_cast<AppListButton*>(
+ Launcher::ForWindow(*it)->GetLauncherViewForTest()->
+ GetAppListButtonView());
+ app_list_buttons.push_back(button);
+ EXPECT_FALSE(button->toggled());
+ }
+
+ Shell* shell = Shell::GetInstance();
+
+ EXPECT_FALSE(shell->GetAppListTargetVisibility());
+ shell->ToggleAppList(root_windows[0]);
+ EXPECT_TRUE(shell->GetAppListTargetVisibility());
+ EXPECT_TRUE(app_list_buttons[0]->toggled());
+ EXPECT_FALSE(app_list_buttons[1]->toggled());
+
+ shell->ToggleAppList(NULL);
+ EXPECT_FALSE(shell->GetAppListTargetVisibility());
+
+ shell->ToggleAppList(root_windows[1]);
+ EXPECT_TRUE(shell->GetAppListTargetVisibility());
+ EXPECT_FALSE(app_list_buttons[0]->toggled());
+ EXPECT_TRUE(app_list_buttons[1]->toggled());
+}
+
} // namespace ash
« no previous file with comments | « ash/launcher/app_list_button.cc ('k') | ash/launcher/launcher_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698