| 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 "ash/session/session_state_delegate.h" | 7 #include "ash/session/session_state_delegate.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
| 10 #include "ash/test/test_lock_state_controller_delegate.h" | 10 #include "ash/test/test_lock_state_controller_delegate.h" |
| (...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 ReleasePowerButton(); | 900 ReleasePowerButton(); |
| 901 } | 901 } |
| 902 | 902 |
| 903 #if defined(OS_CHROMEOS) | 903 #if defined(OS_CHROMEOS) |
| 904 TEST_F(LockStateControllerTest, HonorPowerButtonInDockedMode) { | 904 TEST_F(LockStateControllerTest, HonorPowerButtonInDockedMode) { |
| 905 ScopedVector<const ui::DisplayMode> modes; | 905 ScopedVector<const ui::DisplayMode> modes; |
| 906 modes.push_back(new ui::DisplayMode(gfx::Size(1, 1), false, 60.0f)); | 906 modes.push_back(new ui::DisplayMode(gfx::Size(1, 1), false, 60.0f)); |
| 907 | 907 |
| 908 // Create two outputs, the first internal and the second external. | 908 // Create two outputs, the first internal and the second external. |
| 909 ui::DisplayConfigurator::DisplayStateList outputs; | 909 ui::DisplayConfigurator::DisplayStateList outputs; |
| 910 ui::DisplayConfigurator::DisplayState internal_output; | |
| 911 ui::TestDisplaySnapshot internal_display; | 910 ui::TestDisplaySnapshot internal_display; |
| 912 internal_display.set_type(ui::DISPLAY_CONNECTION_TYPE_INTERNAL); | 911 internal_display.set_type(ui::DISPLAY_CONNECTION_TYPE_INTERNAL); |
| 913 internal_display.set_modes(modes.get()); | 912 internal_display.set_modes(modes.get()); |
| 914 internal_output.display = &internal_display; | 913 outputs.push_back(&internal_display); |
| 915 outputs.push_back(internal_output); | |
| 916 | 914 |
| 917 ui::DisplayConfigurator::DisplayState external_output; | |
| 918 ui::TestDisplaySnapshot external_display; | 915 ui::TestDisplaySnapshot external_display; |
| 919 external_display.set_type(ui::DISPLAY_CONNECTION_TYPE_HDMI); | 916 external_display.set_type(ui::DISPLAY_CONNECTION_TYPE_HDMI); |
| 920 external_display.set_modes(modes.get()); | 917 external_display.set_modes(modes.get()); |
| 921 external_output.display = &external_display; | 918 outputs.push_back(&external_display); |
| 922 outputs.push_back(external_output); | |
| 923 | 919 |
| 924 // When all of the displays are turned off (e.g. due to user inactivity), the | 920 // When all of the displays are turned off (e.g. due to user inactivity), the |
| 925 // power button should be ignored. | 921 // power button should be ignored. |
| 926 power_button_controller_->OnScreenBrightnessChanged(0.0); | 922 power_button_controller_->OnScreenBrightnessChanged(0.0); |
| 927 static_cast<ui::TestDisplaySnapshot*>(outputs[0].display) | 923 internal_display.set_current_mode(nullptr); |
| 928 ->set_current_mode(NULL); | 924 external_display.set_current_mode(nullptr); |
| 929 static_cast<ui::TestDisplaySnapshot*>(outputs[1].display) | |
| 930 ->set_current_mode(NULL); | |
| 931 power_button_controller_->OnDisplayModeChanged(outputs); | 925 power_button_controller_->OnDisplayModeChanged(outputs); |
| 932 PressPowerButton(); | 926 PressPowerButton(); |
| 933 EXPECT_FALSE(test_api_->is_animating_lock()); | 927 EXPECT_FALSE(test_api_->is_animating_lock()); |
| 934 ReleasePowerButton(); | 928 ReleasePowerButton(); |
| 935 | 929 |
| 936 // When the screen brightness is 0% but the external display is still turned | 930 // When the screen brightness is 0% but the external display is still turned |
| 937 // on (indicating either docked mode or the user having manually decreased the | 931 // on (indicating either docked mode or the user having manually decreased the |
| 938 // brightness to 0%), the power button should still be handled. | 932 // brightness to 0%), the power button should still be handled. |
| 939 static_cast<ui::TestDisplaySnapshot*>(outputs[1].display) | 933 external_display.set_current_mode(modes[0]); |
| 940 ->set_current_mode(modes[0]); | |
| 941 power_button_controller_->OnDisplayModeChanged(outputs); | 934 power_button_controller_->OnDisplayModeChanged(outputs); |
| 942 PressPowerButton(); | 935 PressPowerButton(); |
| 943 EXPECT_TRUE(test_api_->is_animating_lock()); | 936 EXPECT_TRUE(test_api_->is_animating_lock()); |
| 944 ReleasePowerButton(); | 937 ReleasePowerButton(); |
| 945 } | 938 } |
| 946 #endif | 939 #endif |
| 947 | 940 |
| 948 // Test that hidden background appears and revers correctly on lock/cancel. | 941 // Test that hidden background appears and revers correctly on lock/cancel. |
| 949 TEST_F(LockStateControllerTest, TestHiddenBackgroundLockCancel) { | 942 TEST_F(LockStateControllerTest, TestHiddenBackgroundLockCancel) { |
| 950 Initialize(false, user::LOGGED_IN_USER); | 943 Initialize(false, user::LOGGED_IN_USER); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 ReleasePowerButton(); | 1100 ReleasePowerButton(); |
| 1108 | 1101 |
| 1109 ExpectPreLockAnimationStarted(); | 1102 ExpectPreLockAnimationStarted(); |
| 1110 | 1103 |
| 1111 test_animator_->CompleteAllAnimations(true); | 1104 test_animator_->CompleteAllAnimations(true); |
| 1112 EXPECT_EQ(1, lock_state_controller_delegate_->num_lock_requests()); | 1105 EXPECT_EQ(1, lock_state_controller_delegate_->num_lock_requests()); |
| 1113 } | 1106 } |
| 1114 | 1107 |
| 1115 } // namespace test | 1108 } // namespace test |
| 1116 } // namespace ash | 1109 } // namespace ash |
| OLD | NEW |