OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/launcher/launcher.h" | 5 #include "ash/launcher/launcher.h" |
6 #include "ash/launcher/launcher_button.h" | 6 #include "ash/launcher/launcher_button.h" |
7 #include "ash/launcher/launcher_model.h" | 7 #include "ash/launcher/launcher_model.h" |
8 #include "ash/launcher/launcher_view.h" | 8 #include "ash/launcher/launcher_view.h" |
9 | 9 |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
11 #include "ash/test/ash_test_base.h" | 11 #include "ash/test/ash_test_base.h" |
12 #include "ash/test/launcher_view_test_api.h" | 12 #include "ash/test/launcher_view_test_api.h" |
13 #include "ash/wm/window_util.h" | |
14 #include "ui/views/view.h" | 13 #include "ui/views/view.h" |
15 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
16 | 15 |
17 typedef ash::test::AshTestBase LauncherTest; | 16 typedef ash::test::AshTestBase LauncherTest; |
18 using ash::internal::LauncherView; | 17 using ash::internal::LauncherView; |
19 using ash::internal::LauncherButton; | 18 using ash::internal::LauncherButton; |
20 | 19 |
21 namespace ash { | 20 namespace ash { |
22 | 21 |
23 // Makes sure invoking SetStatusSize on the launcher changes the size of the | 22 // Makes sure invoking SetStatusSize on the launcher changes the size of the |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 int index = model->Add(item); | 70 int index = model->Add(item); |
72 ASSERT_EQ(++button_count, test.GetButtonCount()); | 71 ASSERT_EQ(++button_count, test.GetButtonCount()); |
73 LauncherButton* button = test.GetButton(index); | 72 LauncherButton* button = test.GetButton(index); |
74 EXPECT_EQ(LauncherButton::STATE_RUNNING, button->state()); | 73 EXPECT_EQ(LauncherButton::STATE_RUNNING, button->state()); |
75 | 74 |
76 // Remove it. | 75 // Remove it. |
77 model->RemoveItemAt(index); | 76 model->RemoveItemAt(index); |
78 ASSERT_EQ(--button_count, test.GetButtonCount()); | 77 ASSERT_EQ(--button_count, test.GetButtonCount()); |
79 } | 78 } |
80 | 79 |
81 // Launcher can't be activated on mouse click, but it is activable from | |
82 // the focus cycler or as fallback. | |
83 TEST_F(LauncherTest, ActivateAsFallback) { | |
84 Launcher* launcher = Launcher::ForPrimaryDisplay(); | |
85 views::Widget* launcher_widget = launcher->widget(); | |
86 EXPECT_FALSE(launcher_widget->CanActivate()); | |
87 | |
88 launcher->WillActivateAsFallback(); | |
89 EXPECT_TRUE(launcher_widget->CanActivate()); | |
90 | |
91 wm::ActivateWindow(launcher_widget->GetNativeWindow()); | |
92 EXPECT_FALSE(launcher_widget->CanActivate()); | |
93 } | |
94 | |
95 } // namespace ash | 80 } // namespace ash |
OLD | NEW |