| 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/common/session/session_state_delegate.h" | 10 #include "ash/common/session/session_state_delegate.h" |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 // Power button is released while system attempts to lock. | 636 // Power button is released while system attempts to lock. |
| 637 ReleasePowerButton(); | 637 ReleasePowerButton(); |
| 638 | 638 |
| 639 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); | 639 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); |
| 640 | 640 |
| 641 EXPECT_FALSE(lock_state_controller_->ShutdownRequested()); | 641 EXPECT_FALSE(lock_state_controller_->ShutdownRequested()); |
| 642 EXPECT_FALSE(test_api_->lock_to_shutdown_timer_is_running()); | 642 EXPECT_FALSE(test_api_->lock_to_shutdown_timer_is_running()); |
| 643 EXPECT_FALSE(test_api_->shutdown_timer_is_running()); | 643 EXPECT_FALSE(test_api_->shutdown_timer_is_running()); |
| 644 } | 644 } |
| 645 | 645 |
| 646 // TODO(bruthig): Investigate why this hangs on Windows 8 and whether it can be | |
| 647 // safely enabled on OS_WIN. | |
| 648 #ifndef OS_WIN | |
| 649 // Test that we handle the case where lock requests are ignored. | 646 // Test that we handle the case where lock requests are ignored. |
| 650 TEST_F(LockStateControllerTest, Lock) { | 647 TEST_F(LockStateControllerTest, Lock) { |
| 651 Initialize(false, LoginStatus::USER); | 648 Initialize(false, LoginStatus::USER); |
| 652 | 649 |
| 653 // Hold the power button and lock the screen. | 650 // Hold the power button and lock the screen. |
| 654 PressPowerButton(); | 651 PressPowerButton(); |
| 655 ExpectPreLockAnimationStarted(); | 652 ExpectPreLockAnimationStarted(); |
| 656 | 653 |
| 657 Advance(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE); | 654 Advance(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE); |
| 658 | 655 |
| 659 EXPECT_EQ(1, session_manager_client_->request_lock_screen_call_count()); | 656 EXPECT_EQ(1, session_manager_client_->request_lock_screen_call_count()); |
| 660 EXPECT_TRUE(test_api_->lock_fail_timer_is_running()); | 657 EXPECT_TRUE(test_api_->lock_fail_timer_is_running()); |
| 661 // We shouldn't start the lock-to-shutdown timer until the screen has actually | 658 // We shouldn't start the lock-to-shutdown timer until the screen has actually |
| 662 // been locked and this was animated. | 659 // been locked and this was animated. |
| 663 EXPECT_FALSE(test_api_->lock_to_shutdown_timer_is_running()); | 660 EXPECT_FALSE(test_api_->lock_to_shutdown_timer_is_running()); |
| 664 | 661 |
| 665 // Act as if the request timed out. | 662 // Act as if the request timed out. |
| 666 EXPECT_DEATH(test_api_->trigger_lock_fail_timeout(), ""); | 663 EXPECT_DEATH(test_api_->trigger_lock_fail_timeout(), ""); |
| 667 } | 664 } |
| 668 #endif | |
| 669 | 665 |
| 670 // Test the basic operation of the lock button (not logged in). | 666 // Test the basic operation of the lock button (not logged in). |
| 671 TEST_F(LockStateControllerTest, LockButtonBasicNotLoggedIn) { | 667 TEST_F(LockStateControllerTest, LockButtonBasicNotLoggedIn) { |
| 672 // The lock button shouldn't do anything if we aren't logged in. | 668 // The lock button shouldn't do anything if we aren't logged in. |
| 673 Initialize(false, LoginStatus::NOT_LOGGED_IN); | 669 Initialize(false, LoginStatus::NOT_LOGGED_IN); |
| 674 | 670 |
| 675 PressLockButton(); | 671 PressLockButton(); |
| 676 EXPECT_FALSE(test_api_->is_animating_lock()); | 672 EXPECT_FALSE(test_api_->is_animating_lock()); |
| 677 ReleaseLockButton(); | 673 ReleaseLockButton(); |
| 678 EXPECT_EQ(0, session_manager_client_->request_lock_screen_call_count()); | 674 EXPECT_EQ(0, session_manager_client_->request_lock_screen_call_count()); |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 ASSERT_EQ(0, delegate->handle_take_screenshot_count()); | 1059 ASSERT_EQ(0, delegate->handle_take_screenshot_count()); |
| 1064 PressVolumeDown(); | 1060 PressVolumeDown(); |
| 1065 PressPowerButton(); | 1061 PressPowerButton(); |
| 1066 ReleasePowerButton(); | 1062 ReleasePowerButton(); |
| 1067 ReleaseVolumeDown(); | 1063 ReleaseVolumeDown(); |
| 1068 EXPECT_EQ(1, delegate->handle_take_screenshot_count()); | 1064 EXPECT_EQ(1, delegate->handle_take_screenshot_count()); |
| 1069 } | 1065 } |
| 1070 | 1066 |
| 1071 } // namespace test | 1067 } // namespace test |
| 1072 } // namespace ash | 1068 } // namespace ash |
| OLD | NEW |