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 |