OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/common/accelerators/accelerator_controller.h" | 5 #include "ash/common/accelerators/accelerator_controller.h" |
6 | 6 |
7 #include "ash/common/shell_observer.h" | 7 #include "ash/common/shell_observer.h" |
8 #include "ash/common/system/chromeos/network/network_observer.h" | 8 #include "ash/common/system/chromeos/network/network_observer.h" |
9 #include "ash/common/system/tray/system_tray_delegate.h" | 9 #include "ash/common/system/tray/system_tray_delegate.h" |
10 #include "ash/common/system/tray/system_tray_notifier.h" | 10 #include "ash/common/system/tray/system_tray_notifier.h" |
11 #include "ash/common/wm/window_state.h" | 11 #include "ash/common/wm/window_state.h" |
12 #include "ash/common/wm_shell.h" | 12 #include "ash/common/wm_shell.h" |
13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
14 #include "ash/test/ash_interactive_ui_test_base.h" | 14 #include "ash/test/ash_interactive_ui_test_base.h" |
15 #include "ash/test/test_screenshot_delegate.h" | 15 #include "ash/test/test_screenshot_delegate.h" |
16 #include "ash/wm/window_state_aura.h" | 16 #include "ash/wm/window_state_aura.h" |
17 #include "ash/wm/window_util.h" | 17 #include "ash/wm/window_util.h" |
18 #include "base/run_loop.h" | 18 #include "base/run_loop.h" |
19 #include "base/test/user_action_tester.cc" | 19 #include "base/test/user_action_tester.cc" |
20 #include "chromeos/network/network_handler.h" | 20 #include "chromeos/network/network_handler.h" |
| 21 #include "mojo/edk/embedder/embedder.h" |
| 22 #include "ui/app_list/presenter/app_list.h" |
| 23 #include "ui/app_list/presenter/test/test_app_list_presenter.h" |
21 #include "ui/base/test/ui_controls.h" | 24 #include "ui/base/test/ui_controls.h" |
22 | 25 |
23 namespace ash { | 26 namespace ash { |
24 namespace test { | 27 namespace test { |
25 | 28 |
26 namespace { | 29 namespace { |
27 | 30 |
28 // A network observer to watch for the toggle wifi events. | 31 // A network observer to watch for the toggle wifi events. |
29 class TestNetworkObserver : public NetworkObserver { | 32 class TestNetworkObserver : public NetworkObserver { |
30 public: | 33 public: |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 EXPECT_TRUE(network_observer.wifi_enabled_status()); | 191 EXPECT_TRUE(network_observer.wifi_enabled_status()); |
189 SendKeyPressSync(ui::VKEY_WLAN, false, false, false); | 192 SendKeyPressSync(ui::VKEY_WLAN, false, false, false); |
190 EXPECT_FALSE(network_observer.wifi_enabled_status()); | 193 EXPECT_FALSE(network_observer.wifi_enabled_status()); |
191 | 194 |
192 WmShell::Get()->system_tray_notifier()->RemoveNetworkObserver( | 195 WmShell::Get()->system_tray_notifier()->RemoveNetworkObserver( |
193 &network_observer); | 196 &network_observer); |
194 } | 197 } |
195 | 198 |
196 // Tests the app list accelerator. | 199 // Tests the app list accelerator. |
197 TEST_F(AcceleratorInteractiveUITest, MAYBE_ToggleAppList) { | 200 TEST_F(AcceleratorInteractiveUITest, MAYBE_ToggleAppList) { |
198 EXPECT_FALSE(WmShell::Get()->GetAppListTargetVisibility()); | 201 mojo::edk::Init(); |
| 202 app_list::test::TestAppListPresenter test_app_list_presenter; |
| 203 WmShell::Get()->app_list()->SetAppListPresenter( |
| 204 test_app_list_presenter.CreateInterfacePtrAndBind()); |
| 205 |
| 206 EXPECT_EQ(0u, test_app_list_presenter.toggle_count()); |
199 SendKeyPressSync(ui::VKEY_LWIN, false, false, false); | 207 SendKeyPressSync(ui::VKEY_LWIN, false, false, false); |
200 EXPECT_TRUE(WmShell::Get()->GetAppListTargetVisibility()); | 208 RunAllPendingInMessageLoop(); |
| 209 EXPECT_EQ(1u, test_app_list_presenter.toggle_count()); |
201 SendKeyPressSync(ui::VKEY_LWIN, false, false, false); | 210 SendKeyPressSync(ui::VKEY_LWIN, false, false, false); |
202 EXPECT_FALSE(WmShell::Get()->GetAppListTargetVisibility()); | 211 RunAllPendingInMessageLoop(); |
| 212 EXPECT_EQ(2u, test_app_list_presenter.toggle_count()); |
203 } | 213 } |
204 | 214 |
205 } // namespace test | 215 } // namespace test |
206 } // namespace ash | 216 } // namespace ash |
OLD | NEW |