Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: ash/wm/lock_state_controller_unittest.cc

Issue 811033002: Add device policy to disallow shutdown - ash UI modifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/wm/lock_state_controller.cc ('k') | ash/wm/power_button_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY)); 811 SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY));
812 GenerateMouseMoveEvent(); 812 GenerateMouseMoveEvent();
813 EXPECT_FALSE(cursor_visible()); 813 EXPECT_FALSE(cursor_visible());
814 } 814 }
815 815
816 // Test that we display the fast-close animation and shut down when we get an 816 // Test that we display the fast-close animation and shut down when we get an
817 // outside request to shut down (e.g. from the login or lock screen). 817 // outside request to shut down (e.g. from the login or lock screen).
818 TEST_F(LockStateControllerTest, RequestShutdownFromLoginScreen) { 818 TEST_F(LockStateControllerTest, RequestShutdownFromLoginScreen) {
819 Initialize(false, user::LOGGED_IN_NONE); 819 Initialize(false, user::LOGGED_IN_NONE);
820 820
821 lock_state_controller_->RequestShutdown(LockStateController::POWER_OFF); 821 lock_state_controller_->RequestShutdown();
822 822
823 ExpectShutdownAnimationStarted(); 823 ExpectShutdownAnimationStarted();
824 Advance(SessionStateAnimator::ANIMATION_SPEED_SHUTDOWN); 824 Advance(SessionStateAnimator::ANIMATION_SPEED_SHUTDOWN);
825 825
826 GenerateMouseMoveEvent(); 826 GenerateMouseMoveEvent();
827 EXPECT_FALSE(cursor_visible()); 827 EXPECT_FALSE(cursor_visible());
828 828
829 EXPECT_EQ(0, NumShutdownRequests()); 829 EXPECT_EQ(0, NumShutdownRequests());
830 EXPECT_TRUE(test_api_->real_shutdown_timer_is_running()); 830 EXPECT_TRUE(test_api_->real_shutdown_timer_is_running());
831 test_api_->trigger_real_shutdown_timeout(); 831 test_api_->trigger_real_shutdown_timeout();
832 EXPECT_EQ(1, NumShutdownRequests()); 832 EXPECT_EQ(1, NumShutdownRequests());
833 } 833 }
834 834
835 TEST_F(LockStateControllerTest, RequestShutdownFromLockScreen) { 835 TEST_F(LockStateControllerTest, RequestShutdownFromLockScreen) {
836 Initialize(false, user::LOGGED_IN_USER); 836 Initialize(false, user::LOGGED_IN_USER);
837 837
838 SystemLocks(); 838 SystemLocks();
839 839
840 Advance(SessionStateAnimator::ANIMATION_SPEED_SHUTDOWN); 840 Advance(SessionStateAnimator::ANIMATION_SPEED_SHUTDOWN);
841 ExpectPostLockAnimationFinished(); 841 ExpectPostLockAnimationFinished();
842 842
843 lock_state_controller_->RequestShutdown(LockStateController::POWER_OFF); 843 lock_state_controller_->RequestShutdown();
844 844
845 ExpectShutdownAnimationStarted(); 845 ExpectShutdownAnimationStarted();
846 Advance(SessionStateAnimator::ANIMATION_SPEED_SHUTDOWN); 846 Advance(SessionStateAnimator::ANIMATION_SPEED_SHUTDOWN);
847 847
848 GenerateMouseMoveEvent(); 848 GenerateMouseMoveEvent();
849 EXPECT_FALSE(cursor_visible()); 849 EXPECT_FALSE(cursor_visible());
850 850
851 EXPECT_EQ(0, NumShutdownRequests()); 851 EXPECT_EQ(0, NumShutdownRequests());
852 EXPECT_TRUE(test_api_->real_shutdown_timer_is_running()); 852 EXPECT_TRUE(test_api_->real_shutdown_timer_is_running());
853 test_api_->trigger_real_shutdown_timeout(); 853 test_api_->trigger_real_shutdown_timeout();
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 ReleasePowerButton(); 1107 ReleasePowerButton();
1108 1108
1109 ExpectPreLockAnimationStarted(); 1109 ExpectPreLockAnimationStarted();
1110 1110
1111 test_animator_->CompleteAllAnimations(true); 1111 test_animator_->CompleteAllAnimations(true);
1112 EXPECT_EQ(1, lock_state_controller_delegate_->num_lock_requests()); 1112 EXPECT_EQ(1, lock_state_controller_delegate_->num_lock_requests());
1113 } 1113 }
1114 1114
1115 } // namespace test 1115 } // namespace test
1116 } // namespace ash 1116 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/lock_state_controller.cc ('k') | ash/wm/power_button_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698