OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/lock_state_controller.h" | 5 #include "ash/wm/lock_state_controller.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "ash/public/cpp/config.h" | 10 #include "ash/public/cpp/config.h" |
11 #include "ash/session/session_controller.h" | 11 #include "ash/session/session_controller.h" |
12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
13 #include "ash/shutdown_controller.h" | 13 #include "ash/shutdown_controller.h" |
14 #include "ash/test/ash_test_base.h" | 14 #include "ash/test/ash_test_base.h" |
15 #include "ash/test/lock_state_controller_test_api.h" | 15 #include "ash/test/lock_state_controller_test_api.h" |
16 #include "ash/test/test_screenshot_delegate.h" | 16 #include "ash/test/test_screenshot_delegate.h" |
17 #include "ash/test/test_session_controller_client.h" | 17 #include "ash/test/test_session_controller_client.h" |
18 #include "ash/test/test_session_state_animator.h" | 18 #include "ash/test/test_session_state_animator.h" |
19 #include "ash/test/test_shell_delegate.h" | 19 #include "ash/test/test_shell_delegate.h" |
20 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | |
21 #include "ash/wm/power_button_controller.h" | 20 #include "ash/wm/power_button_controller.h" |
22 #include "ash/wm/session_state_animator.h" | 21 #include "ash/wm/session_state_animator.h" |
| 22 #include "ash/wm/tablet_mode/tablet_mode_controller.h" |
23 #include "base/memory/ptr_util.h" | 23 #include "base/memory/ptr_util.h" |
24 #include "base/memory/scoped_vector.h" | 24 #include "base/memory/scoped_vector.h" |
25 #include "base/time/time.h" | 25 #include "base/time/time.h" |
26 #include "chromeos/dbus/dbus_thread_manager.h" | 26 #include "chromeos/dbus/dbus_thread_manager.h" |
27 #include "chromeos/dbus/fake_session_manager_client.h" | 27 #include "chromeos/dbus/fake_session_manager_client.h" |
28 #include "ui/display/fake_display_snapshot.h" | 28 #include "ui/display/fake_display_snapshot.h" |
29 #include "ui/display/manager/chromeos/display_configurator.h" | 29 #include "ui/display/manager/chromeos/display_configurator.h" |
30 #include "ui/display/types/display_constants.h" | 30 #include "ui/display/types/display_constants.h" |
31 #include "ui/events/test/event_generator.h" | 31 #include "ui/events/test/event_generator.h" |
32 #include "ui/gfx/geometry/size.h" | 32 #include "ui/gfx/geometry/size.h" |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 void SuccessfulAuthentication(bool* call_flag) { | 320 void SuccessfulAuthentication(bool* call_flag) { |
321 base::Closure closure = base::Bind(&CheckCalledCallback, call_flag); | 321 base::Closure closure = base::Bind(&CheckCalledCallback, call_flag); |
322 lock_state_controller_->OnLockScreenHide(closure); | 322 lock_state_controller_->OnLockScreenHide(closure); |
323 } | 323 } |
324 | 324 |
325 void SystemUnlocks() { | 325 void SystemUnlocks() { |
326 lock_state_controller_->OnLockStateChanged(false); | 326 lock_state_controller_->OnLockStateChanged(false); |
327 GetSessionControllerClient()->UnlockScreen(); | 327 GetSessionControllerClient()->UnlockScreen(); |
328 } | 328 } |
329 | 329 |
330 void EnableMaximizeMode(bool enable) { | 330 void EnableTabletMode(bool enable) { |
331 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 331 Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager( |
332 enable); | 332 enable); |
333 } | 333 } |
334 | 334 |
335 void Initialize(bool legacy_button, LoginStatus status) { | 335 void Initialize(bool legacy_button, LoginStatus status) { |
336 power_button_controller_->set_has_legacy_power_button_for_test( | 336 power_button_controller_->set_has_legacy_power_button_for_test( |
337 legacy_button); | 337 legacy_button); |
338 SetUserLoggedIn(status != LoginStatus::NOT_LOGGED_IN); | 338 SetUserLoggedIn(status != LoginStatus::NOT_LOGGED_IN); |
339 if (status == LoginStatus::GUEST) | 339 if (status == LoginStatus::GUEST) |
340 SetCanLockScreen(false); | 340 SetCanLockScreen(false); |
341 } | 341 } |
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 } | 1028 } |
1029 | 1029 |
1030 TEST_F(LockStateControllerTest, Screenshot) { | 1030 TEST_F(LockStateControllerTest, Screenshot) { |
1031 // TODO: fails because of no screenshot in mash. http://crbug.com/698033. | 1031 // TODO: fails because of no screenshot in mash. http://crbug.com/698033. |
1032 if (Shell::GetAshConfig() == Config::MASH) | 1032 if (Shell::GetAshConfig() == Config::MASH) |
1033 return; | 1033 return; |
1034 | 1034 |
1035 test::TestScreenshotDelegate* delegate = GetScreenshotDelegate(); | 1035 test::TestScreenshotDelegate* delegate = GetScreenshotDelegate(); |
1036 delegate->set_can_take_screenshot(true); | 1036 delegate->set_can_take_screenshot(true); |
1037 | 1037 |
1038 EnableMaximizeMode(false); | 1038 EnableTabletMode(false); |
1039 | 1039 |
1040 // Screenshot handling should not be active when not in maximize mode. | 1040 // Screenshot handling should not be active when not in tablet mode. |
1041 ASSERT_EQ(0, delegate->handle_take_screenshot_count()); | 1041 ASSERT_EQ(0, delegate->handle_take_screenshot_count()); |
1042 PressVolumeDown(); | 1042 PressVolumeDown(); |
1043 PressPowerButton(); | 1043 PressPowerButton(); |
1044 ReleasePowerButton(); | 1044 ReleasePowerButton(); |
1045 ReleaseVolumeDown(); | 1045 ReleaseVolumeDown(); |
1046 EXPECT_EQ(0, delegate->handle_take_screenshot_count()); | 1046 EXPECT_EQ(0, delegate->handle_take_screenshot_count()); |
1047 | 1047 |
1048 EnableMaximizeMode(true); | 1048 EnableTabletMode(true); |
1049 | 1049 |
1050 // Pressing power alone does not take a screenshot. | 1050 // Pressing power alone does not take a screenshot. |
1051 PressPowerButton(); | 1051 PressPowerButton(); |
1052 ReleasePowerButton(); | 1052 ReleasePowerButton(); |
1053 EXPECT_EQ(0, delegate->handle_take_screenshot_count()); | 1053 EXPECT_EQ(0, delegate->handle_take_screenshot_count()); |
1054 | 1054 |
1055 // Press & release volume then pressing power does not take a screenshot. | 1055 // Press & release volume then pressing power does not take a screenshot. |
1056 ASSERT_EQ(0, delegate->handle_take_screenshot_count()); | 1056 ASSERT_EQ(0, delegate->handle_take_screenshot_count()); |
1057 PressVolumeDown(); | 1057 PressVolumeDown(); |
1058 ReleaseVolumeDown(); | 1058 ReleaseVolumeDown(); |
(...skipping 13 matching lines...) Expand all Loading... |
1072 ASSERT_EQ(0, delegate->handle_take_screenshot_count()); | 1072 ASSERT_EQ(0, delegate->handle_take_screenshot_count()); |
1073 PressVolumeDown(); | 1073 PressVolumeDown(); |
1074 PressPowerButton(); | 1074 PressPowerButton(); |
1075 ReleasePowerButton(); | 1075 ReleasePowerButton(); |
1076 ReleaseVolumeDown(); | 1076 ReleaseVolumeDown(); |
1077 EXPECT_EQ(1, delegate->handle_take_screenshot_count()); | 1077 EXPECT_EQ(1, delegate->handle_take_screenshot_count()); |
1078 } | 1078 } |
1079 | 1079 |
1080 } // namespace test | 1080 } // namespace test |
1081 } // namespace ash | 1081 } // namespace ash |
OLD | NEW |