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/accelerators/accelerator_controller.h" | 5 #include "ash/accelerators/accelerator_controller.h" |
6 #include "ash/accelerators/accelerator_table.h" | 6 #include "ash/accelerators/accelerator_table.h" |
7 #include "ash/caps_lock_delegate.h" | 7 #include "ash/caps_lock_delegate.h" |
8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
9 #include "ash/ime_control_delegate.h" | 9 #include "ash/ime_control_delegate.h" |
10 #include "ash/screenshot_delegate.h" | 10 #include "ash/screenshot_delegate.h" |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
310 public: | 310 public: |
311 AcceleratorControllerTest() {}; | 311 AcceleratorControllerTest() {}; |
312 virtual ~AcceleratorControllerTest() {}; | 312 virtual ~AcceleratorControllerTest() {}; |
313 | 313 |
314 protected: | 314 protected: |
315 void EnableInternalDisplay() { | 315 void EnableInternalDisplay() { |
316 Shell::GetInstance()->display_manager()-> | 316 Shell::GetInstance()->display_manager()-> |
317 SetFirstDisplayAsInternalDisplayForTest(); | 317 SetFirstDisplayAsInternalDisplayForTest(); |
318 } | 318 } |
319 | 319 |
320 void DisableInternalDisplay() { | |
oshima
2013/02/12 17:38:51
It's better to reset in AshTestBase::TearDown,
and
ynovikov
2013/02/12 21:17:47
Done.
| |
321 Shell::GetInstance()->display_manager()->ResetInternalDisplayForTest(); | |
322 } | |
323 | |
320 static AcceleratorController* GetController(); | 324 static AcceleratorController* GetController(); |
321 static bool ProcessWithContext(const ui::Accelerator& accelerator); | 325 static bool ProcessWithContext(const ui::Accelerator& accelerator); |
322 | 326 |
323 private: | 327 private: |
324 DISALLOW_COPY_AND_ASSIGN(AcceleratorControllerTest); | 328 DISALLOW_COPY_AND_ASSIGN(AcceleratorControllerTest); |
325 }; | 329 }; |
326 | 330 |
327 AcceleratorController* AcceleratorControllerTest::GetController() { | 331 AcceleratorController* AcceleratorControllerTest::GetController() { |
328 return Shell::GetInstance()->accelerator_controller(); | 332 return Shell::GetInstance()->accelerator_controller(); |
329 } | 333 } |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
884 // Open file manager dialog | 888 // Open file manager dialog |
885 EXPECT_TRUE(ProcessWithContext( | 889 EXPECT_TRUE(ProcessWithContext( |
886 ui::Accelerator(ui::VKEY_O, ui::EF_CONTROL_DOWN))); | 890 ui::Accelerator(ui::VKEY_O, ui::EF_CONTROL_DOWN))); |
887 | 891 |
888 // Lock screen | 892 // Lock screen |
889 // NOTE: Accelerators that do not work on the lock screen need to be | 893 // NOTE: Accelerators that do not work on the lock screen need to be |
890 // tested before the sequence below is invoked because it causes a side | 894 // tested before the sequence below is invoked because it causes a side |
891 // effect of locking the screen. | 895 // effect of locking the screen. |
892 EXPECT_TRUE(ProcessWithContext( | 896 EXPECT_TRUE(ProcessWithContext( |
893 ui::Accelerator(ui::VKEY_L, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN))); | 897 ui::Accelerator(ui::VKEY_L, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN))); |
898 DisableInternalDisplay(); | |
894 #endif | 899 #endif |
895 } | 900 } |
896 | 901 |
897 TEST_F(AcceleratorControllerTest, GlobalAcceleratorsToggleAppList) { | 902 TEST_F(AcceleratorControllerTest, GlobalAcceleratorsToggleAppList) { |
898 test::TestShellDelegate* delegate = | 903 test::TestShellDelegate* delegate = |
899 reinterpret_cast<test::TestShellDelegate*>( | 904 reinterpret_cast<test::TestShellDelegate*>( |
900 ash::Shell::GetInstance()->delegate()); | 905 ash::Shell::GetInstance()->delegate()); |
901 EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility()); | 906 EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility()); |
902 | 907 |
903 // The press event should not open the AppList, the release should instead. | 908 // The press event should not open the AppList, the release should instead. |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1232 EXPECT_EQ(volume_mute, delegate->last_accelerator()); | 1237 EXPECT_EQ(volume_mute, delegate->last_accelerator()); |
1233 EXPECT_EQ(0, delegate->handle_volume_down_count()); | 1238 EXPECT_EQ(0, delegate->handle_volume_down_count()); |
1234 EXPECT_TRUE(ProcessWithContext(volume_down)); | 1239 EXPECT_TRUE(ProcessWithContext(volume_down)); |
1235 EXPECT_EQ(1, delegate->handle_volume_down_count()); | 1240 EXPECT_EQ(1, delegate->handle_volume_down_count()); |
1236 EXPECT_EQ(volume_down, delegate->last_accelerator()); | 1241 EXPECT_EQ(volume_down, delegate->last_accelerator()); |
1237 EXPECT_EQ(0, delegate->handle_volume_up_count()); | 1242 EXPECT_EQ(0, delegate->handle_volume_up_count()); |
1238 EXPECT_TRUE(ProcessWithContext(volume_up)); | 1243 EXPECT_TRUE(ProcessWithContext(volume_up)); |
1239 EXPECT_EQ(1, delegate->handle_volume_up_count()); | 1244 EXPECT_EQ(1, delegate->handle_volume_up_count()); |
1240 EXPECT_EQ(volume_up, delegate->last_accelerator()); | 1245 EXPECT_EQ(volume_up, delegate->last_accelerator()); |
1241 } | 1246 } |
1247 DisableInternalDisplay(); | |
1242 } | 1248 } |
1243 #endif | 1249 #endif |
1244 | 1250 |
1245 } // namespace ash | 1251 } // namespace ash |
OLD | NEW |