OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/wm/maximize_mode/maximize_mode_controller.h" | 5 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
6 | 6 |
7 #include "ash/accelerometer/accelerometer_controller.h" | 7 #include "ash/accelerometer/accelerometer_controller.h" |
8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/system/tray/system_tray_delegate.h" | 10 #include "ash/system/tray/system_tray_delegate.h" |
11 #include "ash/test/ash_test_base.h" | 11 #include "ash/test/ash_test_base.h" |
12 #include "ash/test/display_manager_test_api.h" | 12 #include "ash/test/display_manager_test_api.h" |
13 #include "ash/test/test_lock_state_controller_delegate.h" | 13 #include "ash/test/test_lock_state_controller_delegate.h" |
14 #include "ash/test/test_screenshot_delegate.h" | 14 #include "ash/test/test_screenshot_delegate.h" |
15 #include "ash/test/test_system_tray_delegate.h" | 15 #include "ash/test/test_system_tray_delegate.h" |
16 #include "ash/test/test_volume_control_delegate.h" | 16 #include "ash/test/test_volume_control_delegate.h" |
17 #include "ui/aura/test/event_generator.h" | |
18 #include "ui/events/event_handler.h" | 17 #include "ui/events/event_handler.h" |
| 18 #include "ui/events/test/event_generator.h" |
19 #include "ui/gfx/vector3d_f.h" | 19 #include "ui/gfx/vector3d_f.h" |
20 #include "ui/message_center/message_center.h" | 20 #include "ui/message_center/message_center.h" |
21 | 21 |
22 #if defined(USE_X11) | 22 #if defined(USE_X11) |
23 #include "ui/events/test/events_test_utils_x11.h" | 23 #include "ui/events/test/events_test_utils_x11.h" |
24 #endif | 24 #endif |
25 | 25 |
26 namespace ash { | 26 namespace ash { |
27 | 27 |
28 namespace { | 28 namespace { |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); | 263 EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); |
264 } | 264 } |
265 | 265 |
266 #if defined(OS_CHROMEOS) | 266 #if defined(OS_CHROMEOS) |
267 // Tests that a screenshot can be taken in maximize mode by holding volume down | 267 // Tests that a screenshot can be taken in maximize mode by holding volume down |
268 // and pressing power. | 268 // and pressing power. |
269 TEST_F(MaximizeModeControllerTest, Screenshot) { | 269 TEST_F(MaximizeModeControllerTest, Screenshot) { |
270 Shell::GetInstance()->lock_state_controller()->SetDelegate( | 270 Shell::GetInstance()->lock_state_controller()->SetDelegate( |
271 new test::TestLockStateControllerDelegate); | 271 new test::TestLockStateControllerDelegate); |
272 aura::Window* root = Shell::GetPrimaryRootWindow(); | 272 aura::Window* root = Shell::GetPrimaryRootWindow(); |
273 aura::test::EventGenerator event_generator(root, root); | 273 ui::test::EventGenerator event_generator(root, root); |
274 test::TestScreenshotDelegate* delegate = GetScreenshotDelegate(); | 274 test::TestScreenshotDelegate* delegate = GetScreenshotDelegate(); |
275 delegate->set_can_take_screenshot(true); | 275 delegate->set_can_take_screenshot(true); |
276 | 276 |
277 // Open up 270 degrees. | 277 // Open up 270 degrees. |
278 TriggerAccelerometerUpdate(gfx::Vector3dF(0.0f, 0.0f, 1.0f), | 278 TriggerAccelerometerUpdate(gfx::Vector3dF(0.0f, 0.0f, 1.0f), |
279 gfx::Vector3dF(1.0f, 0.0f, 0.0f)); | 279 gfx::Vector3dF(1.0f, 0.0f, 0.0f)); |
280 ASSERT_TRUE(IsMaximizeModeStarted()); | 280 ASSERT_TRUE(IsMaximizeModeStarted()); |
281 | 281 |
282 // Pressing power alone does not take a screenshot. | 282 // Pressing power alone does not take a screenshot. |
283 event_generator.PressKey(ui::VKEY_POWER, 0); | 283 event_generator.PressKey(ui::VKEY_POWER, 0); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 // User sets rotation to the same rotation that the display was at when | 490 // User sets rotation to the same rotation that the display was at when |
491 // maximize mode was activated. | 491 // maximize mode was activated. |
492 SetInternalDisplayRotation(gfx::Display::ROTATE_0); | 492 SetInternalDisplayRotation(gfx::Display::ROTATE_0); |
493 // Exit maximize mode | 493 // Exit maximize mode |
494 TriggerAccelerometerUpdate(gfx::Vector3dF(0.0f, 0.0f, 1.0f), | 494 TriggerAccelerometerUpdate(gfx::Vector3dF(0.0f, 0.0f, 1.0f), |
495 gfx::Vector3dF(-1.0f, 0.0f, 0.0f)); | 495 gfx::Vector3dF(-1.0f, 0.0f, 0.0f)); |
496 EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); | 496 EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); |
497 } | 497 } |
498 | 498 |
499 } // namespace ash | 499 } // namespace ash |
OLD | NEW |