Chromium Code Reviews| 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/ash_switches.h" | |
| 8 #include "ash/session/session_state_delegate.h" | 7 #include "ash/session/session_state_delegate.h" |
| 9 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 10 #include "ash/shell_window_ids.h" | |
| 11 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
| 12 #include "ash/test/test_lock_state_controller_delegate.h" | 10 #include "ash/test/test_lock_state_controller_delegate.h" |
| 11 #include "ash/test/test_screenshot_delegate.h" | |
| 12 #include "ash/test/test_session_state_animator.h" | |
| 13 #include "ash/test/test_shell_delegate.h" | 13 #include "ash/test/test_shell_delegate.h" |
| 14 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | |
| 14 #include "ash/wm/power_button_controller.h" | 15 #include "ash/wm/power_button_controller.h" |
| 15 #include "ash/wm/session_state_animator.h" | 16 #include "ash/wm/session_state_animator.h" |
| 16 #include "base/command_line.h" | |
| 17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/memory/scoped_vector.h" | |
| 18 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 19 #include "ui/aura/env.h" | |
| 20 #include "ui/aura/test/test_window_delegate.h" | |
| 21 #include "ui/aura/window_event_dispatcher.h" | |
| 22 #include "ui/compositor/layer_animator.h" | |
| 23 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | |
| 24 #include "ui/compositor/scoped_layer_animation_settings.h" | |
| 25 #include "ui/events/test/event_generator.h" | 20 #include "ui/events/test/event_generator.h" |
| 26 #include "ui/gfx/rect.h" | |
| 27 #include "ui/gfx/size.h" | 21 #include "ui/gfx/size.h" |
| 28 | 22 |
| 29 #if defined(OS_CHROMEOS) | 23 #if defined(OS_CHROMEOS) |
| 30 #include "ui/display/chromeos/display_configurator.h" | 24 #include "ui/display/chromeos/display_configurator.h" |
| 31 #include "ui/display/chromeos/test/test_display_snapshot.h" | 25 #include "ui/display/chromeos/test/test_display_snapshot.h" |
| 32 #include "ui/display/types/display_constants.h" | 26 #include "ui/display/types/display_constants.h" |
| 33 #endif | 27 #endif |
| 34 | 28 |
| 35 #if defined(OS_WIN) | |
| 36 #include "base/win/windows_version.h" | |
| 37 #endif | |
| 38 | |
| 39 namespace ash { | 29 namespace ash { |
| 40 namespace test { | 30 namespace test { |
| 41 namespace { | 31 namespace { |
| 42 | 32 |
| 43 bool cursor_visible() { | 33 bool cursor_visible() { |
| 44 return ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible(); | 34 return ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible(); |
| 45 } | 35 } |
| 46 | 36 |
| 47 void CheckCalledCallback(bool* flag) { | 37 void CheckCalledCallback(bool* flag) { |
| 48 if (flag) | 38 if (flag) |
| 49 (*flag) = true; | 39 (*flag) = true; |
| 50 } | 40 } |
| 51 | 41 |
| 52 aura::Window* GetContainer(int container ) { | 42 } // namespace |
| 53 aura::Window* root_window = Shell::GetPrimaryRootWindow(); | |
| 54 return Shell::GetContainer(root_window, container); | |
| 55 } | |
| 56 | |
| 57 bool IsBackgroundHidden() { | |
| 58 return !GetContainer(kShellWindowId_DesktopBackgroundContainer)->IsVisible(); | |
| 59 } | |
| 60 | |
| 61 void HideBackground() { | |
| 62 ui::ScopedLayerAnimationSettings settings( | |
| 63 GetContainer(kShellWindowId_DesktopBackgroundContainer) | |
| 64 ->layer() | |
| 65 ->GetAnimator()); | |
| 66 settings.SetTransitionDuration(base::TimeDelta()); | |
| 67 GetContainer(kShellWindowId_DesktopBackgroundContainer)->Hide(); | |
| 68 } | |
| 69 | |
| 70 } // namespace | |
| 71 | 43 |
| 72 class LockStateControllerTest : public AshTestBase { | 44 class LockStateControllerTest : public AshTestBase { |
| 73 public: | 45 public: |
| 74 LockStateControllerTest() : controller_(NULL), delegate_(NULL) {} | 46 LockStateControllerTest() : power_button_controller_(NULL), |
| 47 lock_state_controller_(NULL), | |
| 48 lock_state_controller_delegate_(NULL), | |
| 49 test_animator_(NULL) { | |
| 50 } | |
| 75 virtual ~LockStateControllerTest() {} | 51 virtual ~LockStateControllerTest() {} |
| 76 | 52 |
| 77 virtual void SetUp() OVERRIDE { | 53 virtual void SetUp() OVERRIDE { |
| 78 AshTestBase::SetUp(); | 54 AshTestBase::SetUp(); |
| 79 | 55 |
| 80 // We would control animations in a fine way: | 56 lock_state_controller_delegate_ = new TestLockStateControllerDelegate; |
| 81 animation_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( | 57 test_animator_ = new TestSessionStateAnimator; |
| 82 ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION)); | |
| 83 // TODO(antrim) : restore | |
| 84 // animator_helper_ = ui::test::CreateLayerAnimatorHelperForTest(); | |
| 85 | 58 |
| 86 // Temporary disable animations so that observer is always called, and | 59 lock_state_controller_ = Shell::GetInstance()->lock_state_controller(); |
| 87 // no leaks happen during tests. | 60 lock_state_controller_->SetDelegate(lock_state_controller_delegate_); |
| 88 animation_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( | 61 lock_state_controller_->set_animator_for_test(test_animator_); |
| 89 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); | |
| 90 // TODO(antrim): once there is a way to mock time and run animations, make | |
| 91 // sure that animations are finished even in simple tests. | |
| 92 | 62 |
| 93 delegate_ = new TestLockStateControllerDelegate; | |
| 94 controller_ = Shell::GetInstance()->power_button_controller(); | |
| 95 lock_state_controller_ = static_cast<LockStateController*>( | |
| 96 Shell::GetInstance()->lock_state_controller()); | |
| 97 lock_state_controller_->SetDelegate(delegate_); // transfers ownership | |
| 98 test_api_.reset(new LockStateController::TestApi(lock_state_controller_)); | 63 test_api_.reset(new LockStateController::TestApi(lock_state_controller_)); |
| 99 animator_api_.reset( | 64 |
| 100 new SessionStateAnimator::TestApi(lock_state_controller_-> | 65 power_button_controller_ = Shell::GetInstance()->power_button_controller(); |
| 101 animator_.get())); | 66 session_state_delegate_ = Shell::GetInstance()->session_state_delegate(); |
| 67 | |
| 102 shell_delegate_ = reinterpret_cast<TestShellDelegate*>( | 68 shell_delegate_ = reinterpret_cast<TestShellDelegate*>( |
| 103 ash::Shell::GetInstance()->delegate()); | 69 ash::Shell::GetInstance()->delegate()); |
| 104 session_state_delegate_ = Shell::GetInstance()->session_state_delegate(); | |
| 105 } | |
| 106 | |
| 107 virtual void TearDown() { | |
| 108 // TODO(antrim) : restore | |
| 109 // animator_helper_->AdvanceUntilDone(); | |
| 110 window_.reset(); | |
| 111 AshTestBase::TearDown(); | |
| 112 } | 70 } |
| 113 | 71 |
| 114 protected: | 72 protected: |
| 115 void GenerateMouseMoveEvent() { | 73 void GenerateMouseMoveEvent() { |
| 116 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); | 74 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); |
| 117 generator.MoveMouseTo(10, 10); | 75 generator.MoveMouseTo(10, 10); |
| 118 } | 76 } |
| 119 | 77 |
| 120 int NumShutdownRequests() { | 78 int NumShutdownRequests() { |
| 121 return delegate_->num_shutdown_requests() + | 79 return lock_state_controller_delegate_->num_shutdown_requests() + |
| 122 shell_delegate_->num_exit_requests(); | 80 shell_delegate_->num_exit_requests(); |
| 123 } | 81 } |
| 124 | 82 |
| 125 void Advance(SessionStateAnimator::AnimationSpeed speed) { | 83 void Advance(SessionStateAnimator::AnimationSpeed speed) { |
| 126 // TODO (antrim) : restore | 84 test_animator_->Advance(test_animator_->GetDuration(speed)); |
| 127 // animator_helper_->Advance(SessionStateAnimator::GetDuration(speed)); | |
| 128 } | 85 } |
| 129 | 86 |
| 130 void AdvancePartially(SessionStateAnimator::AnimationSpeed speed, | 87 void AdvancePartially(SessionStateAnimator::AnimationSpeed speed, |
| 131 float factor) { | 88 float factor) { |
| 132 // TODO (antrim) : restore | 89 base::TimeDelta duration = test_animator_->GetDuration(speed); |
| 133 // base::TimeDelta duration = SessionStateAnimator::GetDuration(speed); | 90 base::TimeDelta partial_duration = |
| 134 // base::TimeDelta partial_duration = | 91 base::TimeDelta::FromInternalValue(duration.ToInternalValue() * factor); |
| 135 // base::TimeDelta::FromInternalValue(duration.ToInternalValue() * factor); | 92 test_animator_->Advance(partial_duration); |
| 136 // animator_helper_->Advance(partial_duration); | |
| 137 } | 93 } |
| 138 | 94 |
| 139 void ExpectPreLockAnimationStarted() { | 95 void ExpectPreLockAnimationStarted() { |
| 140 //TODO (antrim) : restore EXPECT_TRUE(animator_helper_->IsAnimating()); | 96 SCOPED_TRACE("Failure in ExpectPreLockAnimationStarted"); |
|
Daniel Erat
2014/09/08 16:16:02
nit: should this keep a EXPECT_EQ(0u, test_animato
bruthig
2014/09/09 17:32:34
Done.
| |
| 141 EXPECT_TRUE( | 97 EXPECT_TRUE( |
| 142 animator_api_->ContainersAreAnimated( | 98 test_animator_->AreContainersAnimated( |
| 143 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, | 99 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, |
| 144 SessionStateAnimator::ANIMATION_LIFT)); | 100 SessionStateAnimator::ANIMATION_LIFT)); |
| 145 EXPECT_TRUE( | 101 EXPECT_TRUE( |
| 146 animator_api_->ContainersAreAnimated( | 102 test_animator_->AreContainersAnimated( |
| 147 SessionStateAnimator::LAUNCHER, | 103 SessionStateAnimator::LAUNCHER, |
| 148 SessionStateAnimator::ANIMATION_FADE_OUT)); | 104 SessionStateAnimator::ANIMATION_FADE_OUT)); |
| 149 EXPECT_TRUE( | 105 EXPECT_TRUE( |
| 150 animator_api_->ContainersAreAnimated( | 106 test_animator_->AreContainersAnimated( |
| 151 SessionStateAnimator::LOCK_SCREEN_CONTAINERS, | 107 SessionStateAnimator::LOCK_SCREEN_CONTAINERS, |
| 152 SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY)); | 108 SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY)); |
| 153 EXPECT_TRUE(test_api_->is_animating_lock()); | 109 EXPECT_TRUE(test_api_->is_animating_lock()); |
| 154 } | 110 } |
| 155 | 111 |
| 112 void ExpectPreLockAnimationRunning() { | |
| 113 SCOPED_TRACE("Failure in ExpectPreLockAnimationRunning"); | |
| 114 EXPECT_TRUE( | |
| 115 test_animator_->AreContainersAnimated( | |
| 116 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, | |
| 117 SessionStateAnimator::ANIMATION_LIFT)); | |
| 118 EXPECT_TRUE( | |
| 119 test_animator_->AreContainersAnimated( | |
| 120 SessionStateAnimator::LAUNCHER, | |
| 121 SessionStateAnimator::ANIMATION_FADE_OUT)); | |
| 122 EXPECT_TRUE(test_api_->is_animating_lock()); | |
| 123 } | |
| 124 | |
| 156 void ExpectPreLockAnimationCancel() { | 125 void ExpectPreLockAnimationCancel() { |
| 157 EXPECT_TRUE( | 126 SCOPED_TRACE("Failure in ExpectPreLockAnimationCancel"); |
| 158 animator_api_->ContainersAreAnimated( | 127 EXPECT_TRUE( |
| 128 test_animator_->AreContainersAnimated( | |
| 129 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, | |
| 130 SessionStateAnimator::ANIMATION_UNDO_LIFT)); | |
| 131 EXPECT_TRUE( | |
| 132 test_animator_->AreContainersAnimated( | |
| 133 SessionStateAnimator::LAUNCHER, | |
| 134 SessionStateAnimator::ANIMATION_FADE_IN)); | |
| 135 } | |
| 136 | |
| 137 void ExpectPreLockAnimationFinished() { | |
| 138 SCOPED_TRACE("Failure in ExpectPreLockAnimationFinished"); | |
| 139 EXPECT_FALSE( | |
| 140 test_animator_->AreContainersAnimated( | |
| 141 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, | |
| 142 SessionStateAnimator::ANIMATION_LIFT)); | |
| 143 EXPECT_FALSE( | |
| 144 test_animator_->AreContainersAnimated( | |
| 145 SessionStateAnimator::LAUNCHER, | |
| 146 SessionStateAnimator::ANIMATION_FADE_OUT)); | |
| 147 EXPECT_FALSE( | |
| 148 test_animator_->AreContainersAnimated( | |
| 149 SessionStateAnimator::LOCK_SCREEN_CONTAINERS, | |
| 150 SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY)); | |
| 151 } | |
| 152 | |
| 153 void ExpectPostLockAnimationStarted() { | |
| 154 SCOPED_TRACE("Failure in ExpectPostLockAnimationStarted"); | |
| 155 EXPECT_TRUE( | |
| 156 test_animator_->AreContainersAnimated( | |
| 157 SessionStateAnimator::LOCK_SCREEN_CONTAINERS, | |
| 158 SessionStateAnimator::ANIMATION_RAISE_TO_SCREEN)); | |
| 159 } | |
| 160 | |
| 161 void ExpectPostLockAnimationFinished() { | |
| 162 SCOPED_TRACE("Failure in ExpectPostLockAnimationFinished"); | |
| 163 EXPECT_FALSE( | |
| 164 test_animator_->AreContainersAnimated( | |
| 165 SessionStateAnimator::LOCK_SCREEN_CONTAINERS, | |
| 166 SessionStateAnimator::ANIMATION_RAISE_TO_SCREEN)); | |
| 167 } | |
| 168 | |
| 169 void ExpectUnlockBeforeUIDestroyedAnimationStarted() { | |
| 170 SCOPED_TRACE("Failure in ExpectUnlockBeforeUIDestroyedAnimationStarted"); | |
| 171 EXPECT_LT(0u, test_animator_->GetAnimationCount()); | |
| 172 EXPECT_TRUE( | |
| 173 test_animator_->AreContainersAnimated( | |
| 174 SessionStateAnimator::LOCK_SCREEN_CONTAINERS, | |
| 175 SessionStateAnimator::ANIMATION_LIFT)); | |
| 176 } | |
| 177 | |
| 178 void ExpectUnlockBeforeUIDestroyedAnimationFinished() { | |
| 179 SCOPED_TRACE("Failure in ExpectUnlockBeforeUIDestroyedAnimationFinished"); | |
| 180 EXPECT_FALSE( | |
| 181 test_animator_->AreContainersAnimated( | |
| 182 SessionStateAnimator::LOCK_SCREEN_CONTAINERS, | |
| 183 SessionStateAnimator::ANIMATION_LIFT)); | |
| 184 } | |
| 185 | |
| 186 void ExpectUnlockAfterUIDestroyedAnimationStarted() { | |
| 187 SCOPED_TRACE("Failure in ExpectUnlockAfterUIDestroyedAnimationStarted"); | |
| 188 EXPECT_LT(0u, test_animator_->GetAnimationCount()); | |
| 189 EXPECT_TRUE( | |
| 190 test_animator_->AreContainersAnimated( | |
| 159 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, | 191 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, |
| 160 SessionStateAnimator::ANIMATION_DROP)); | 192 SessionStateAnimator::ANIMATION_DROP)); |
| 161 EXPECT_TRUE( | 193 EXPECT_TRUE( |
| 162 animator_api_->ContainersAreAnimated( | 194 test_animator_->AreContainersAnimated( |
| 163 SessionStateAnimator::LAUNCHER, | 195 SessionStateAnimator::LAUNCHER, |
| 164 SessionStateAnimator::ANIMATION_FADE_IN)); | 196 SessionStateAnimator::ANIMATION_FADE_IN)); |
| 165 } | 197 } |
| 166 | 198 |
| 167 void ExpectPreLockAnimationFinished() { | 199 void ExpectUnlockAfterUIDestroyedAnimationFinished() { |
| 168 //TODO (antrim) : restore EXPECT_FALSE(animator_helper_->IsAnimating()); | 200 SCOPED_TRACE("Failure in ExpectUnlockAfterUIDestroyedAnimationFinished"); |
| 169 EXPECT_TRUE( | 201 EXPECT_EQ(0u, test_animator_->GetAnimationCount()); |
| 170 animator_api_->ContainersAreAnimated( | 202 EXPECT_FALSE( |
| 171 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, | 203 test_animator_->AreContainersAnimated( |
| 172 SessionStateAnimator::ANIMATION_LIFT)); | |
| 173 EXPECT_TRUE( | |
| 174 animator_api_->ContainersAreAnimated( | |
| 175 SessionStateAnimator::LAUNCHER, | |
| 176 SessionStateAnimator::ANIMATION_FADE_OUT)); | |
| 177 EXPECT_TRUE( | |
| 178 animator_api_->ContainersAreAnimated( | |
| 179 SessionStateAnimator::LOCK_SCREEN_CONTAINERS, | |
| 180 SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY)); | |
| 181 } | |
| 182 | |
| 183 void ExpectPostLockAnimationStarted() { | |
| 184 //TODO (antrim) : restore EXPECT_TRUE(animator_helper_->IsAnimating()); | |
| 185 EXPECT_TRUE( | |
| 186 animator_api_->ContainersAreAnimated( | |
| 187 SessionStateAnimator::LOCK_SCREEN_CONTAINERS, | |
| 188 SessionStateAnimator::ANIMATION_RAISE_TO_SCREEN)); | |
| 189 } | |
| 190 | |
| 191 void ExpectPastLockAnimationFinished() { | |
| 192 //TODO (antrim) : restore EXPECT_FALSE(animator_helper_->IsAnimating()); | |
| 193 EXPECT_TRUE( | |
| 194 animator_api_->ContainersAreAnimated( | |
| 195 SessionStateAnimator::LOCK_SCREEN_CONTAINERS, | |
| 196 SessionStateAnimator::ANIMATION_RAISE_TO_SCREEN)); | |
| 197 } | |
| 198 | |
| 199 void ExpectUnlockBeforeUIDestroyedAnimationStarted() { | |
| 200 //TODO (antrim) : restore EXPECT_TRUE(animator_helper_->IsAnimating()); | |
| 201 EXPECT_TRUE( | |
| 202 animator_api_->ContainersAreAnimated( | |
| 203 SessionStateAnimator::LOCK_SCREEN_CONTAINERS, | |
| 204 SessionStateAnimator::ANIMATION_LIFT)); | |
| 205 } | |
| 206 | |
| 207 void ExpectUnlockBeforeUIDestroyedAnimationFinished() { | |
| 208 //TODO (antrim) : restore EXPECT_FALSE(animator_helper_->IsAnimating()); | |
| 209 EXPECT_TRUE( | |
| 210 animator_api_->ContainersAreAnimated( | |
| 211 SessionStateAnimator::LOCK_SCREEN_CONTAINERS, | |
| 212 SessionStateAnimator::ANIMATION_LIFT)); | |
| 213 } | |
| 214 | |
| 215 void ExpectUnlockAfterUIDestroyedAnimationStarted() { | |
| 216 //TODO (antrim) : restore EXPECT_TRUE(animator_helper_->IsAnimating()); | |
| 217 EXPECT_TRUE( | |
| 218 animator_api_->ContainersAreAnimated( | |
| 219 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, | 204 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, |
| 220 SessionStateAnimator::ANIMATION_DROP)); | 205 SessionStateAnimator::ANIMATION_DROP)); |
| 221 EXPECT_TRUE( | 206 EXPECT_FALSE( |
| 222 animator_api_->ContainersAreAnimated( | 207 test_animator_->AreContainersAnimated( |
| 223 SessionStateAnimator::LAUNCHER, | 208 SessionStateAnimator::LAUNCHER, |
| 224 SessionStateAnimator::ANIMATION_FADE_IN)); | 209 SessionStateAnimator::ANIMATION_FADE_IN)); |
| 225 } | 210 } |
| 226 | 211 |
| 227 void ExpectUnlockAfterUIDestroyedAnimationFinished() { | |
| 228 //TODO (antrim) : restore EXPECT_FALSE(animator_helper_->IsAnimating()); | |
| 229 EXPECT_TRUE( | |
| 230 animator_api_->ContainersAreAnimated( | |
| 231 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, | |
| 232 SessionStateAnimator::ANIMATION_DROP)); | |
| 233 EXPECT_TRUE( | |
| 234 animator_api_->ContainersAreAnimated( | |
| 235 SessionStateAnimator::LAUNCHER, | |
| 236 SessionStateAnimator::ANIMATION_FADE_IN)); | |
| 237 } | |
| 238 | |
| 239 void ExpectShutdownAnimationStarted() { | 212 void ExpectShutdownAnimationStarted() { |
| 240 //TODO (antrim) : restore EXPECT_TRUE(animator_helper_->IsAnimating()); | 213 SCOPED_TRACE("Failure in ExpectShutdownAnimationStarted"); |
|
Daniel Erat
2014/09/08 16:16:02
nit: should this keep a EXPECT_EQ(0u, test_animato
bruthig
2014/09/09 17:32:34
Done.
| |
| 241 EXPECT_TRUE( | 214 EXPECT_TRUE( |
| 242 animator_api_->RootWindowIsAnimated( | 215 test_animator_->AreContainersAnimated( |
| 216 SessionStateAnimator::ROOT_CONTAINER, | |
| 243 SessionStateAnimator::ANIMATION_GRAYSCALE_BRIGHTNESS)); | 217 SessionStateAnimator::ANIMATION_GRAYSCALE_BRIGHTNESS)); |
| 244 } | 218 } |
| 245 | 219 |
| 246 void ExpectShutdownAnimationFinished() { | 220 void ExpectShutdownAnimationFinished() { |
| 247 //TODO (antrim) : restore EXPECT_FALSE(animator_helper_->IsAnimating()); | 221 SCOPED_TRACE("Failure in ExpectShutdownAnimationFinished"); |
| 248 EXPECT_TRUE( | 222 EXPECT_EQ(0u, test_animator_->GetAnimationCount()); |
| 249 animator_api_->RootWindowIsAnimated( | 223 EXPECT_FALSE( |
| 224 test_animator_->AreContainersAnimated( | |
| 225 SessionStateAnimator::ROOT_CONTAINER, | |
| 250 SessionStateAnimator::ANIMATION_GRAYSCALE_BRIGHTNESS)); | 226 SessionStateAnimator::ANIMATION_GRAYSCALE_BRIGHTNESS)); |
| 251 } | 227 } |
| 252 | 228 |
| 253 void ExpectShutdownAnimationCancel() { | 229 void ExpectShutdownAnimationCancel() { |
| 254 //TODO (antrim) : restore EXPECT_TRUE(animator_helper_->IsAnimating()); | 230 SCOPED_TRACE("Failure in ExpectShutdownAnimationCancel"); |
| 255 EXPECT_TRUE( | 231 EXPECT_LT(0u, test_animator_->GetAnimationCount()); |
| 256 animator_api_->RootWindowIsAnimated( | 232 EXPECT_TRUE( |
| 233 test_animator_->AreContainersAnimated( | |
| 234 SessionStateAnimator::ROOT_CONTAINER, | |
| 257 SessionStateAnimator::ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS)); | 235 SessionStateAnimator::ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS)); |
| 258 } | 236 } |
| 259 | 237 |
| 260 void ExpectBackgroundIsShowing() { | |
| 261 //TODO (antrim) : restore EXPECT_TRUE(animator_helper_->IsAnimating()); | |
| 262 EXPECT_TRUE( | |
| 263 animator_api_->ContainersAreAnimated( | |
| 264 SessionStateAnimator::DESKTOP_BACKGROUND, | |
| 265 SessionStateAnimator::ANIMATION_FADE_IN)); | |
| 266 } | |
| 267 | |
| 268 void ExpectBackgroundIsHiding() { | |
| 269 //TODO (antrim) : restore EXPECT_TRUE(animator_helper_->IsAnimating()); | |
| 270 EXPECT_TRUE( | |
| 271 animator_api_->ContainersAreAnimated( | |
| 272 SessionStateAnimator::DESKTOP_BACKGROUND, | |
| 273 SessionStateAnimator::ANIMATION_FADE_OUT)); | |
| 274 } | |
| 275 | |
| 276 void ExpectUnlockedState() { | 238 void ExpectUnlockedState() { |
| 277 //TODO (antrim) : restore EXPECT_FALSE(animator_helper_->IsAnimating()); | 239 SCOPED_TRACE("Failure in ExpectUnlockedState"); |
| 240 EXPECT_EQ(0u, test_animator_->GetAnimationCount()); | |
| 278 EXPECT_FALSE(session_state_delegate_->IsScreenLocked()); | 241 EXPECT_FALSE(session_state_delegate_->IsScreenLocked()); |
| 279 | |
| 280 aura::Window::Windows containers; | |
| 281 | |
| 282 SessionStateAnimator::GetContainers( | |
| 283 SessionStateAnimator::LAUNCHER | | |
| 284 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, | |
| 285 &containers); | |
| 286 for (aura::Window::Windows::const_iterator it = containers.begin(); | |
| 287 it != containers.end(); ++it) { | |
| 288 aura::Window* window = *it; | |
| 289 ui::Layer* layer = window->layer(); | |
| 290 EXPECT_EQ(1.0f, layer->opacity()); | |
| 291 EXPECT_EQ(0.0f, layer->layer_brightness()); | |
| 292 EXPECT_EQ(0.0f, layer->layer_saturation()); | |
| 293 EXPECT_EQ(gfx::Transform(), layer->transform()); | |
| 294 } | |
| 295 } | 242 } |
| 296 | 243 |
| 297 void ExpectLockedState() { | 244 void ExpectLockedState() { |
| 298 //TODO (antrim) : restore EXPECT_FALSE(animator_helper_->IsAnimating()); | 245 SCOPED_TRACE("Failure in ExpectLockedState"); |
| 246 EXPECT_EQ(0u, test_animator_->GetAnimationCount()); | |
| 247 EXPECT_EQ(0u, test_animator_->GetAnimationCount()); | |
| 299 EXPECT_TRUE(session_state_delegate_->IsScreenLocked()); | 248 EXPECT_TRUE(session_state_delegate_->IsScreenLocked()); |
| 300 | |
| 301 aura::Window::Windows containers; | |
| 302 | |
| 303 SessionStateAnimator::GetContainers( | |
| 304 SessionStateAnimator::LOCK_SCREEN_RELATED_CONTAINERS | | |
| 305 SessionStateAnimator::LOCK_SCREEN_CONTAINERS, | |
| 306 &containers); | |
| 307 for (aura::Window::Windows::const_iterator it = containers.begin(); | |
| 308 it != containers.end(); ++it) { | |
| 309 aura::Window* window = *it; | |
| 310 ui::Layer* layer = window->layer(); | |
| 311 EXPECT_EQ(1.0f, layer->opacity()); | |
| 312 EXPECT_EQ(0.0f, layer->layer_brightness()); | |
| 313 EXPECT_EQ(0.0f, layer->layer_saturation()); | |
| 314 EXPECT_EQ(gfx::Transform(), layer->transform()); | |
| 315 } | |
| 316 } | 249 } |
| 317 | 250 |
| 318 void PressPowerButton() { | 251 void PressPowerButton() { |
| 319 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); | 252 power_button_controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); |
| 320 //TODO (antrim) : restore animator_helper_->Advance(base::TimeDelta()); | |
| 321 } | 253 } |
| 322 | 254 |
| 323 void ReleasePowerButton() { | 255 void ReleasePowerButton() { |
| 324 controller_->OnPowerButtonEvent(false, base::TimeTicks::Now()); | 256 power_button_controller_->OnPowerButtonEvent(false, base::TimeTicks::Now()); |
| 325 //TODO (antrim) : restore animator_helper_->Advance(base::TimeDelta()); | |
| 326 } | 257 } |
| 327 | 258 |
| 328 void PressLockButton() { | 259 void PressLockButton() { |
| 329 controller_->OnLockButtonEvent(true, base::TimeTicks::Now()); | 260 power_button_controller_->OnLockButtonEvent(true, base::TimeTicks::Now()); |
| 330 } | 261 } |
| 331 | 262 |
| 332 void ReleaseLockButton() { | 263 void ReleaseLockButton() { |
| 333 controller_->OnLockButtonEvent(false, base::TimeTicks::Now()); | 264 power_button_controller_->OnLockButtonEvent(false, base::TimeTicks::Now()); |
| 265 } | |
| 266 | |
| 267 void PressVolumeDown() { | |
| 268 GetEventGenerator().PressKey(ui::VKEY_VOLUME_DOWN, ui::EF_NONE); | |
| 269 } | |
| 270 | |
| 271 void ReleaseVolumeDown() { | |
| 272 GetEventGenerator().ReleaseKey(ui::VKEY_VOLUME_DOWN, ui::EF_NONE); | |
| 334 } | 273 } |
| 335 | 274 |
| 336 void SystemLocks() { | 275 void SystemLocks() { |
| 337 lock_state_controller_->OnLockStateChanged(true); | 276 lock_state_controller_->OnLockStateChanged(true); |
| 338 session_state_delegate_->LockScreen(); | 277 session_state_delegate_->LockScreen(); |
| 339 //TODO (antrim) : restore animator_helper_->Advance(base::TimeDelta()); | |
| 340 } | 278 } |
| 341 | 279 |
| 342 void SuccessfulAuthentication(bool* call_flag) { | 280 void SuccessfulAuthentication(bool* call_flag) { |
| 343 base::Closure closure = base::Bind(&CheckCalledCallback, call_flag); | 281 base::Closure closure = base::Bind(&CheckCalledCallback, call_flag); |
| 344 lock_state_controller_->OnLockScreenHide(closure); | 282 lock_state_controller_->OnLockScreenHide(closure); |
| 345 //TODO (antrim) : restore animator_helper_->Advance(base::TimeDelta()); | |
| 346 } | 283 } |
| 347 | 284 |
| 348 void SystemUnlocks() { | 285 void SystemUnlocks() { |
| 349 lock_state_controller_->OnLockStateChanged(false); | 286 lock_state_controller_->OnLockStateChanged(false); |
| 350 session_state_delegate_->UnlockScreen(); | 287 session_state_delegate_->UnlockScreen(); |
| 351 //TODO (antrim) : restore animator_helper_->Advance(base::TimeDelta()); | 288 } |
| 289 | |
| 290 void EnableMaximizeMode(bool enable) { | |
| 291 Shell::GetInstance()->maximize_mode_controller()-> | |
| 292 EnableMaximizeModeWindowManager(enable); | |
| 352 } | 293 } |
| 353 | 294 |
| 354 void Initialize(bool legacy_button, user::LoginStatus status) { | 295 void Initialize(bool legacy_button, user::LoginStatus status) { |
| 355 controller_->set_has_legacy_power_button_for_test(legacy_button); | 296 power_button_controller_->set_has_legacy_power_button_for_test( |
| 297 legacy_button); | |
| 356 lock_state_controller_->OnLoginStateChanged(status); | 298 lock_state_controller_->OnLoginStateChanged(status); |
| 357 SetUserLoggedIn(status != user::LOGGED_IN_NONE); | 299 SetUserLoggedIn(status != user::LOGGED_IN_NONE); |
| 358 if (status == user::LOGGED_IN_GUEST) | 300 if (status == user::LOGGED_IN_GUEST) |
| 359 SetCanLockScreen(false); | 301 SetCanLockScreen(false); |
| 360 lock_state_controller_->OnLockStateChanged(false); | 302 lock_state_controller_->OnLockStateChanged(false); |
| 361 } | 303 } |
| 362 | 304 |
| 363 void CreateWindowForLockscreen() { | 305 PowerButtonController* power_button_controller_; // not owned |
| 364 window_.reset(new aura::Window(&window_delegate_)); | |
| 365 window_->SetBounds(gfx::Rect(0, 0, 100, 100)); | |
| 366 window_->SetType(ui::wm::WINDOW_TYPE_NORMAL); | |
| 367 window_->Init(aura::WINDOW_LAYER_TEXTURED); | |
| 368 window_->SetName("WINDOW"); | |
| 369 aura::Window* container = Shell::GetContainer( | |
| 370 Shell::GetPrimaryRootWindow(), kShellWindowId_LockScreenContainer); | |
| 371 ASSERT_TRUE(container); | |
| 372 container->AddChild(window_.get()); | |
| 373 window_->Show(); | |
| 374 } | |
| 375 | |
| 376 PowerButtonController* controller_; // not owned | |
| 377 LockStateController* lock_state_controller_; // not owned | 306 LockStateController* lock_state_controller_; // not owned |
| 378 TestLockStateControllerDelegate* delegate_; // not owned | 307 TestLockStateControllerDelegate* |
| 308 lock_state_controller_delegate_; // not owned | |
| 309 TestSessionStateAnimator* test_animator_; // not owned | |
| 310 SessionStateDelegate* session_state_delegate_; // not owned | |
| 311 scoped_ptr<LockStateController::TestApi> test_api_; | |
| 379 TestShellDelegate* shell_delegate_; // not owned | 312 TestShellDelegate* shell_delegate_; // not owned |
| 380 SessionStateDelegate* session_state_delegate_; // not owned | |
| 381 | |
| 382 aura::test::TestWindowDelegate window_delegate_; | |
| 383 scoped_ptr<aura::Window> window_; | |
| 384 scoped_ptr<ui::ScopedAnimationDurationScaleMode> animation_duration_mode_; | |
| 385 scoped_ptr<LockStateController::TestApi> test_api_; | |
| 386 scoped_ptr<SessionStateAnimator::TestApi> animator_api_; | |
| 387 // TODO(antrim) : restore | |
| 388 // scoped_ptr<ui::test::AnimationContainerTestHelper> animator_helper_; | |
| 389 | 313 |
| 390 private: | 314 private: |
| 391 DISALLOW_COPY_AND_ASSIGN(LockStateControllerTest); | 315 DISALLOW_COPY_AND_ASSIGN(LockStateControllerTest); |
| 392 }; | 316 }; |
| 393 | 317 |
| 394 // Test the lock-to-shutdown flow for non-Chrome-OS hardware that doesn't | 318 // Test the lock-to-shutdown flow for non-Chrome-OS hardware that doesn't |
| 395 // correctly report power button releases. We should lock immediately the first | 319 // correctly report power button releases. We should lock immediately the first |
| 396 // time the button is pressed and shut down when it's pressed from the locked | 320 // time the button is pressed and shut down when it's pressed from the locked |
| 397 // state. | 321 // state. |
| 398 // TODO(antrim): Reenable this: http://crbug.com/167048 | 322 TEST_F(LockStateControllerTest, LegacyLockAndShutDown) { |
| 399 TEST_F(LockStateControllerTest, DISABLED_LegacyLockAndShutDown) { | |
| 400 Initialize(true, user::LOGGED_IN_USER); | 323 Initialize(true, user::LOGGED_IN_USER); |
| 401 | 324 |
| 402 ExpectUnlockedState(); | 325 ExpectUnlockedState(); |
| 403 | 326 |
| 404 // We should request that the screen be locked immediately after seeing the | 327 // We should request that the screen be locked immediately after seeing the |
| 405 // power button get pressed. | 328 // power button get pressed. |
| 406 PressPowerButton(); | 329 PressPowerButton(); |
| 407 | 330 |
| 408 ExpectPreLockAnimationStarted(); | |
| 409 | |
| 410 EXPECT_FALSE(test_api_->is_lock_cancellable()); | 331 EXPECT_FALSE(test_api_->is_lock_cancellable()); |
| 411 | 332 |
| 412 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); | 333 ExpectPreLockAnimationStarted(); |
| 334 test_animator_->CompleteAllAnimations(true); | |
| 335 ExpectPreLockAnimationFinished(); | |
| 413 | 336 |
| 414 ExpectPreLockAnimationFinished(); | 337 EXPECT_EQ(1, lock_state_controller_delegate_->num_lock_requests()); |
| 415 EXPECT_EQ(1, delegate_->num_lock_requests()); | |
| 416 | 338 |
| 417 // Notify that we locked successfully. | 339 // Notify that we locked successfully. |
| 418 lock_state_controller_->OnStartingLock(); | 340 lock_state_controller_->OnStartingLock(); |
| 419 // We had that animation already. | 341 EXPECT_EQ(0u, test_animator_->GetAnimationCount()); |
| 420 //TODO (antrim) : restore | |
| 421 // EXPECT_FALSE(animator_helper_->IsAnimating()); | |
| 422 | 342 |
| 423 SystemLocks(); | 343 SystemLocks(); |
| 424 | 344 |
| 425 ExpectPostLockAnimationStarted(); | 345 ExpectPostLockAnimationStarted(); |
| 426 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); | 346 test_animator_->CompleteAllAnimations(true); |
| 427 ExpectPastLockAnimationFinished(); | 347 ExpectPostLockAnimationFinished(); |
| 428 | 348 |
| 429 // We shouldn't progress towards the shutdown state, however. | 349 // We shouldn't progress towards the shutdown state, however. |
| 430 EXPECT_FALSE(test_api_->lock_to_shutdown_timer_is_running()); | 350 EXPECT_FALSE(test_api_->lock_to_shutdown_timer_is_running()); |
| 431 EXPECT_FALSE(test_api_->shutdown_timer_is_running()); | 351 EXPECT_FALSE(test_api_->shutdown_timer_is_running()); |
| 432 | 352 |
| 433 ReleasePowerButton(); | 353 ReleasePowerButton(); |
| 434 | 354 |
| 435 // Hold the button again and check that we start shutting down. | 355 // Hold the button again and check that we start shutting down. |
| 436 PressPowerButton(); | 356 PressPowerButton(); |
| 437 | 357 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 503 EXPECT_TRUE(test_api_->real_shutdown_timer_is_running()); | 423 EXPECT_TRUE(test_api_->real_shutdown_timer_is_running()); |
| 504 EXPECT_EQ(0, NumShutdownRequests()); | 424 EXPECT_EQ(0, NumShutdownRequests()); |
| 505 | 425 |
| 506 // When the timout fires, we should request a shutdown. | 426 // When the timout fires, we should request a shutdown. |
| 507 test_api_->trigger_real_shutdown_timeout(); | 427 test_api_->trigger_real_shutdown_timeout(); |
| 508 | 428 |
| 509 EXPECT_EQ(1, NumShutdownRequests()); | 429 EXPECT_EQ(1, NumShutdownRequests()); |
| 510 } | 430 } |
| 511 | 431 |
| 512 // Test that we lock the screen and deal with unlocking correctly. | 432 // Test that we lock the screen and deal with unlocking correctly. |
| 513 // TODO(antrim): Reenable this: http://crbug.com/167048 | 433 TEST_F(LockStateControllerTest, LockAndUnlock) { |
| 514 TEST_F(LockStateControllerTest, DISABLED_LockAndUnlock) { | |
| 515 Initialize(false, user::LOGGED_IN_USER); | 434 Initialize(false, user::LOGGED_IN_USER); |
| 516 | 435 |
| 517 ExpectUnlockedState(); | 436 ExpectUnlockedState(); |
| 518 | 437 |
| 519 // Press the power button and check that the lock timer is started and that we | 438 // Press the power button and check that the lock timer is started and that we |
| 520 // start lifting the non-screen-locker containers. | 439 // start lifting the non-screen-locker containers. |
| 521 PressPowerButton(); | 440 PressPowerButton(); |
| 522 | 441 |
| 523 ExpectPreLockAnimationStarted(); | 442 ExpectPreLockAnimationStarted(); |
| 524 EXPECT_TRUE(test_api_->is_lock_cancellable()); | 443 EXPECT_TRUE(test_api_->is_lock_cancellable()); |
| 525 EXPECT_EQ(0, delegate_->num_lock_requests()); | 444 EXPECT_EQ(0, lock_state_controller_delegate_->num_lock_requests()); |
| 526 | 445 |
| 527 Advance(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE); | 446 test_animator_->CompleteAllAnimations(true); |
| 528 ExpectPreLockAnimationFinished(); | 447 ExpectPreLockAnimationFinished(); |
| 529 | 448 |
| 530 EXPECT_EQ(1, delegate_->num_lock_requests()); | 449 EXPECT_EQ(1, lock_state_controller_delegate_->num_lock_requests()); |
| 531 | 450 |
| 532 // Notify that we locked successfully. | 451 // Notify that we locked successfully. |
| 533 lock_state_controller_->OnStartingLock(); | 452 lock_state_controller_->OnStartingLock(); |
| 534 // We had that animation already. | 453 // We had that animation already. |
| 535 //TODO (antrim) : restore EXPECT_FALSE(animator_helper_->IsAnimating()); | 454 EXPECT_EQ(0u, test_animator_->GetAnimationCount()); |
| 536 | 455 |
| 537 SystemLocks(); | 456 SystemLocks(); |
| 538 | 457 |
| 539 ExpectPostLockAnimationStarted(); | 458 ExpectPostLockAnimationStarted(); |
| 540 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); | 459 test_animator_->CompleteAllAnimations(true); |
| 541 ExpectPastLockAnimationFinished(); | 460 ExpectPostLockAnimationFinished(); |
| 542 | 461 |
| 543 // When we release the power button, the lock-to-shutdown timer should be | 462 // When we release the power button, the lock-to-shutdown timer should be |
| 544 // stopped. | 463 // stopped. |
| 545 ExpectLockedState(); | 464 ExpectLockedState(); |
| 546 EXPECT_TRUE(test_api_->lock_to_shutdown_timer_is_running()); | 465 EXPECT_TRUE(test_api_->lock_to_shutdown_timer_is_running()); |
| 547 ReleasePowerButton(); | 466 ReleasePowerButton(); |
| 548 ExpectLockedState(); | 467 ExpectLockedState(); |
| 549 EXPECT_FALSE(test_api_->lock_to_shutdown_timer_is_running()); | 468 EXPECT_FALSE(test_api_->lock_to_shutdown_timer_is_running()); |
| 550 | 469 |
| 551 // Notify that the screen has been unlocked. We should show the | 470 // Notify that the screen has been unlocked. We should show the |
| 552 // non-screen-locker windows. | 471 // non-screen-locker windows. |
| 553 bool called = false; | 472 bool called = false; |
| 554 SuccessfulAuthentication(&called); | 473 SuccessfulAuthentication(&called); |
| 555 | 474 |
| 556 ExpectUnlockBeforeUIDestroyedAnimationStarted(); | 475 ExpectUnlockBeforeUIDestroyedAnimationStarted(); |
| 557 EXPECT_FALSE(called); | 476 EXPECT_FALSE(called); |
| 558 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); | 477 test_animator_->CompleteAllAnimations(true); |
| 559 ExpectUnlockBeforeUIDestroyedAnimationFinished(); | 478 ExpectUnlockBeforeUIDestroyedAnimationFinished(); |
| 560 | 479 |
| 561 EXPECT_TRUE(called); | 480 EXPECT_TRUE(called); |
| 562 | 481 |
| 563 SystemUnlocks(); | 482 SystemUnlocks(); |
| 564 | 483 |
| 565 ExpectUnlockAfterUIDestroyedAnimationStarted(); | 484 ExpectUnlockAfterUIDestroyedAnimationStarted(); |
| 566 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); | 485 test_animator_->CompleteAllAnimations(true); |
| 567 ExpectUnlockAfterUIDestroyedAnimationFinished(); | 486 ExpectUnlockAfterUIDestroyedAnimationFinished(); |
| 568 | 487 |
| 569 ExpectUnlockedState(); | 488 ExpectUnlockedState(); |
| 570 } | 489 } |
| 571 | 490 |
| 572 // Test that we deal with cancelling lock correctly. | 491 // Test that we deal with cancelling lock correctly. |
| 573 // TODO(antrim): Reenable this: http://crbug.com/167048 | 492 TEST_F(LockStateControllerTest, LockAndCancel) { |
| 574 TEST_F(LockStateControllerTest, DISABLED_LockAndCancel) { | |
| 575 Initialize(false, user::LOGGED_IN_USER); | 493 Initialize(false, user::LOGGED_IN_USER); |
| 576 | 494 |
| 577 ExpectUnlockedState(); | 495 ExpectUnlockedState(); |
| 578 | 496 |
| 579 // Press the power button and check that the lock timer is started and that we | 497 // Press the power button and check that the lock timer is started and that we |
| 580 // start lifting the non-screen-locker containers. | 498 // start lifting the non-screen-locker containers. |
| 581 PressPowerButton(); | 499 PressPowerButton(); |
| 582 | 500 |
| 583 ExpectPreLockAnimationStarted(); | 501 ExpectPreLockAnimationStarted(); |
| 584 EXPECT_TRUE(test_api_->is_lock_cancellable()); | 502 EXPECT_TRUE(test_api_->is_lock_cancellable()); |
| 585 | 503 |
| 586 // forward only half way through | 504 // forward only half way through |
| 587 AdvancePartially(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE, 0.5f); | 505 AdvancePartially(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE, 0.5f); |
| 588 | 506 |
| 589 gfx::Transform transform_before_button_released = | |
| 590 GetContainer(kShellWindowId_DefaultContainer)->layer()->transform(); | |
| 591 | |
| 592 // Release the button before the lock timer fires. | 507 // Release the button before the lock timer fires. |
| 593 ReleasePowerButton(); | 508 ReleasePowerButton(); |
| 594 | 509 |
| 595 ExpectPreLockAnimationCancel(); | 510 ExpectPreLockAnimationCancel(); |
| 596 | 511 |
| 597 gfx::Transform transform_after_button_released = | |
| 598 GetContainer(kShellWindowId_DefaultContainer)->layer()->transform(); | |
| 599 // Expect no flickering, animation should proceed from mid-state. | |
| 600 EXPECT_EQ(transform_before_button_released, transform_after_button_released); | |
| 601 | |
| 602 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); | 512 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); |
| 603 ExpectUnlockedState(); | 513 ExpectUnlockedState(); |
| 604 EXPECT_EQ(0, delegate_->num_lock_requests()); | 514 EXPECT_EQ(0, lock_state_controller_delegate_->num_lock_requests()); |
| 605 } | 515 } |
| 606 | 516 |
| 607 // Test that we deal with cancelling lock correctly. | 517 // Test that we deal with cancelling lock correctly. |
| 608 // TODO(antrim): Reenable this: http://crbug.com/167048 | 518 TEST_F(LockStateControllerTest, LockAndCancelAndLockAgain) { |
| 609 TEST_F(LockStateControllerTest, | |
| 610 DISABLED_LockAndCancelAndLockAgain) { | |
| 611 Initialize(false, user::LOGGED_IN_USER); | 519 Initialize(false, user::LOGGED_IN_USER); |
| 612 | 520 |
| 613 ExpectUnlockedState(); | 521 ExpectUnlockedState(); |
| 614 | 522 |
| 615 // Press the power button and check that the lock timer is started and that we | 523 // Press the power button and check that the lock timer is started and that we |
| 616 // start lifting the non-screen-locker containers. | 524 // start lifting the non-screen-locker containers. |
| 617 PressPowerButton(); | 525 PressPowerButton(); |
| 618 | 526 |
| 619 ExpectPreLockAnimationStarted(); | 527 ExpectPreLockAnimationStarted(); |
| 620 EXPECT_TRUE(test_api_->is_lock_cancellable()); | 528 EXPECT_TRUE(test_api_->is_lock_cancellable()); |
| 621 | 529 |
| 622 // forward only half way through | 530 // forward only half way through |
| 623 AdvancePartially(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE, 0.5f); | 531 AdvancePartially(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE, 0.5f); |
| 624 | 532 |
| 625 // Release the button before the lock timer fires. | 533 // Release the button before the lock timer fires. |
| 626 ReleasePowerButton(); | 534 ReleasePowerButton(); |
| 627 ExpectPreLockAnimationCancel(); | 535 ExpectPreLockAnimationCancel(); |
| 628 | 536 |
| 629 AdvancePartially(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS, 0.5f); | 537 AdvancePartially(SessionStateAnimator::ANIMATION_SPEED_UNDO_MOVE_WINDOWS, |
| 538 0.5f); | |
| 630 | 539 |
| 631 PressPowerButton(); | 540 PressPowerButton(); |
| 632 ExpectPreLockAnimationStarted(); | 541 ExpectPreLockAnimationStarted(); |
| 633 EXPECT_TRUE(test_api_->is_lock_cancellable()); | 542 EXPECT_TRUE(test_api_->is_lock_cancellable()); |
| 634 | 543 |
| 635 AdvancePartially(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE, 0.6f); | 544 AdvancePartially(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE, 0.6f); |
| 636 | 545 |
| 637 EXPECT_EQ(0, delegate_->num_lock_requests()); | 546 EXPECT_EQ(0, lock_state_controller_delegate_->num_lock_requests()); |
| 638 ExpectPreLockAnimationStarted(); | |
| 639 | 547 |
| 640 AdvancePartially(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE, 0.6f); | 548 AdvancePartially(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE, 0.6f); |
| 641 ExpectPreLockAnimationFinished(); | 549 ExpectPreLockAnimationFinished(); |
| 642 EXPECT_EQ(1, delegate_->num_lock_requests()); | 550 EXPECT_EQ(1, lock_state_controller_delegate_->num_lock_requests()); |
| 643 } | 551 } |
| 644 | 552 |
| 645 // Hold the power button down from the unlocked state to eventual shutdown. | 553 // Hold the power button down from the unlocked state to eventual shutdown. |
| 646 // TODO(antrim): Reenable this: http://crbug.com/167048 | 554 TEST_F(LockStateControllerTest, LockToShutdown) { |
| 647 TEST_F(LockStateControllerTest, DISABLED_LockToShutdown) { | |
| 648 Initialize(false, user::LOGGED_IN_USER); | 555 Initialize(false, user::LOGGED_IN_USER); |
| 649 | 556 |
| 650 // Hold the power button and lock the screen. | 557 // Hold the power button and lock the screen. |
| 651 PressPowerButton(); | 558 PressPowerButton(); |
| 652 EXPECT_TRUE(test_api_->is_animating_lock()); | 559 EXPECT_TRUE(test_api_->is_animating_lock()); |
| 653 | 560 |
| 654 Advance(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE); | 561 Advance(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE); |
| 655 SystemLocks(); | 562 SystemLocks(); |
| 656 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); | 563 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); |
| 657 | 564 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 693 ReleasePowerButton(); | 600 ReleasePowerButton(); |
| 694 | 601 |
| 695 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); | 602 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); |
| 696 | 603 |
| 697 EXPECT_FALSE(lock_state_controller_->ShutdownRequested()); | 604 EXPECT_FALSE(lock_state_controller_->ShutdownRequested()); |
| 698 EXPECT_FALSE(test_api_->lock_to_shutdown_timer_is_running()); | 605 EXPECT_FALSE(test_api_->lock_to_shutdown_timer_is_running()); |
| 699 EXPECT_FALSE(test_api_->shutdown_timer_is_running()); | 606 EXPECT_FALSE(test_api_->shutdown_timer_is_running()); |
| 700 } | 607 } |
| 701 | 608 |
| 702 // Test that we handle the case where lock requests are ignored. | 609 // Test that we handle the case where lock requests are ignored. |
| 703 // TODO(antrim): Reenable this: http://crbug.com/167048 | 610 TEST_F(LockStateControllerTest, Lock) { |
| 704 TEST_F(LockStateControllerTest, DISABLED_Lock) { | |
| 705 // We require animations to have a duration for this test. | |
| 706 ui::ScopedAnimationDurationScaleMode normal_duration_mode( | |
| 707 ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); | |
| 708 | |
| 709 Initialize(false, user::LOGGED_IN_USER); | 611 Initialize(false, user::LOGGED_IN_USER); |
| 710 | 612 |
| 711 // Hold the power button and lock the screen. | 613 // Hold the power button and lock the screen. |
| 712 PressPowerButton(); | 614 PressPowerButton(); |
| 713 ExpectPreLockAnimationStarted(); | 615 ExpectPreLockAnimationStarted(); |
| 714 | 616 |
| 715 Advance(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE); | 617 Advance(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE); |
| 716 | 618 |
| 717 EXPECT_EQ(1, delegate_->num_lock_requests()); | 619 EXPECT_EQ(1, lock_state_controller_delegate_->num_lock_requests()); |
| 718 EXPECT_TRUE(test_api_->lock_fail_timer_is_running()); | 620 EXPECT_TRUE(test_api_->lock_fail_timer_is_running()); |
| 719 // We shouldn't start the lock-to-shutdown timer until the screen has actually | 621 // We shouldn't start the lock-to-shutdown timer until the screen has actually |
| 720 // been locked and this was animated. | 622 // been locked and this was animated. |
| 721 EXPECT_FALSE(test_api_->lock_to_shutdown_timer_is_running()); | 623 EXPECT_FALSE(test_api_->lock_to_shutdown_timer_is_running()); |
| 722 | 624 |
| 723 // Act as if the request timed out. We should restore the windows. | 625 // Act as if the request timed out. We should restore the windows. |
| 724 test_api_->trigger_lock_fail_timeout(); | 626 // TODO(bruthig): Before check-in. This causes the following warning |
|
bruthig
2014/09/08 15:33:20
This test expects a crash due to exercising a CHEC
Daniel Erat
2014/09/08 16:16:02
i think the warning is okay, but the above "We sho
bruthig
2014/09/09 17:32:34
Done.
| |
| 725 | 627 // [WARNING] ../../testing/gtest/src/gtest-death-test.cc:825:: Death tests use |
| 726 ExpectUnlockAfterUIDestroyedAnimationStarted(); | 628 // fork(), which is unsafe particularly in a threaded context. For this test, |
| 727 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); | 629 // Google Test couldn't detect the number of threads. |
| 728 ExpectUnlockAfterUIDestroyedAnimationFinished(); | 630 EXPECT_DEATH(test_api_->trigger_lock_fail_timeout(), ""); |
| 729 ExpectUnlockedState(); | |
| 730 } | 631 } |
| 731 | 632 |
| 732 // Test the basic operation of the lock button (not logged in). | 633 // Test the basic operation of the lock button (not logged in). |
| 733 TEST_F(LockStateControllerTest, LockButtonBasicNotLoggedIn) { | 634 TEST_F(LockStateControllerTest, LockButtonBasicNotLoggedIn) { |
| 734 // The lock button shouldn't do anything if we aren't logged in. | 635 // The lock button shouldn't do anything if we aren't logged in. |
| 735 Initialize(false, user::LOGGED_IN_NONE); | 636 Initialize(false, user::LOGGED_IN_NONE); |
| 736 | 637 |
| 737 PressLockButton(); | 638 PressLockButton(); |
| 738 EXPECT_FALSE(test_api_->is_animating_lock()); | 639 EXPECT_FALSE(test_api_->is_animating_lock()); |
| 739 ReleaseLockButton(); | 640 ReleaseLockButton(); |
| 740 EXPECT_EQ(0, delegate_->num_lock_requests()); | 641 EXPECT_EQ(0, lock_state_controller_delegate_->num_lock_requests()); |
| 741 } | 642 } |
| 742 | 643 |
| 743 // Test the basic operation of the lock button (guest). | 644 // Test the basic operation of the lock button (guest). |
| 744 TEST_F(LockStateControllerTest, LockButtonBasicGuest) { | 645 TEST_F(LockStateControllerTest, LockButtonBasicGuest) { |
| 745 // The lock button shouldn't do anything when we're logged in as a guest. | 646 // The lock button shouldn't do anything when we're logged in as a guest. |
| 746 Initialize(false, user::LOGGED_IN_GUEST); | 647 Initialize(false, user::LOGGED_IN_GUEST); |
| 747 | 648 |
| 748 PressLockButton(); | 649 PressLockButton(); |
| 749 EXPECT_FALSE(test_api_->is_animating_lock()); | 650 EXPECT_FALSE(test_api_->is_animating_lock()); |
| 750 ReleaseLockButton(); | 651 ReleaseLockButton(); |
| 751 EXPECT_EQ(0, delegate_->num_lock_requests()); | 652 EXPECT_EQ(0, lock_state_controller_delegate_->num_lock_requests()); |
| 752 } | 653 } |
| 753 | 654 |
| 754 // Test the basic operation of the lock button. | 655 // Test the basic operation of the lock button. |
| 755 // TODO(antrim): Reenable this: http://crbug.com/167048 | 656 TEST_F(LockStateControllerTest, LockButtonBasic) { |
| 756 TEST_F(LockStateControllerTest, DISABLED_LockButtonBasic) { | |
| 757 // If we're logged in as a regular user, we should start the lock timer and | 657 // If we're logged in as a regular user, we should start the lock timer and |
| 758 // the pre-lock animation. | 658 // the pre-lock animation. |
| 759 Initialize(false, user::LOGGED_IN_USER); | 659 Initialize(false, user::LOGGED_IN_USER); |
| 760 | 660 |
| 761 PressLockButton(); | 661 PressLockButton(); |
| 762 ExpectPreLockAnimationStarted(); | 662 ExpectPreLockAnimationStarted(); |
| 763 AdvancePartially(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE, 0.5f); | 663 AdvancePartially(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE, 0.5f); |
| 764 | 664 |
| 765 // If the button is released immediately, we shouldn't lock the screen. | 665 // If the button is released immediately, we shouldn't lock the screen. |
| 766 ReleaseLockButton(); | 666 ReleaseLockButton(); |
| 767 ExpectPreLockAnimationCancel(); | 667 ExpectPreLockAnimationCancel(); |
| 768 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); | 668 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); |
| 769 | 669 |
| 770 ExpectUnlockedState(); | 670 ExpectUnlockedState(); |
| 771 EXPECT_EQ(0, delegate_->num_lock_requests()); | 671 EXPECT_EQ(0, lock_state_controller_delegate_->num_lock_requests()); |
| 772 | 672 |
| 773 // Press the button again and let the lock timeout fire. We should request | 673 // Press the button again and let the lock timeout fire. We should request |
| 774 // that the screen be locked. | 674 // that the screen be locked. |
| 775 PressLockButton(); | 675 PressLockButton(); |
| 776 ExpectPreLockAnimationStarted(); | 676 ExpectPreLockAnimationStarted(); |
| 777 Advance(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE); | 677 Advance(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE); |
| 778 EXPECT_EQ(1, delegate_->num_lock_requests()); | 678 EXPECT_EQ(1, lock_state_controller_delegate_->num_lock_requests()); |
| 779 | 679 |
| 780 // Pressing the lock button while we have a pending lock request shouldn't do | 680 // Pressing the lock button while we have a pending lock request shouldn't do |
| 781 // anything. | 681 // anything. |
| 782 ReleaseLockButton(); | 682 ReleaseLockButton(); |
| 783 PressLockButton(); | 683 PressLockButton(); |
| 784 ExpectPreLockAnimationFinished(); | 684 ExpectPreLockAnimationFinished(); |
| 785 ReleaseLockButton(); | 685 ReleaseLockButton(); |
| 786 | 686 |
| 787 // Pressing the button also shouldn't do anything after the screen is locked. | 687 // Pressing the button also shouldn't do anything after the screen is locked. |
| 788 SystemLocks(); | 688 SystemLocks(); |
| 789 ExpectPostLockAnimationStarted(); | 689 ExpectPostLockAnimationStarted(); |
| 790 | 690 |
| 791 PressLockButton(); | 691 PressLockButton(); |
| 792 ReleaseLockButton(); | 692 ReleaseLockButton(); |
| 793 ExpectPostLockAnimationStarted(); | 693 ExpectPostLockAnimationStarted(); |
| 794 | 694 |
| 795 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); | 695 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); |
| 796 ExpectPastLockAnimationFinished(); | 696 ExpectPostLockAnimationFinished(); |
| 797 | 697 |
| 798 PressLockButton(); | 698 PressLockButton(); |
| 799 ReleaseLockButton(); | 699 ReleaseLockButton(); |
| 800 ExpectPastLockAnimationFinished(); | 700 ExpectPostLockAnimationFinished(); |
| 801 } | 701 } |
| 802 | 702 |
| 803 // Test that the power button takes priority over the lock button. | 703 // Test that the power button takes priority over the lock button. |
| 804 // TODO(antrim): Reenable this: http://crbug.com/167048 | 704 TEST_F(LockStateControllerTest, PowerButtonPreemptsLockButton) { |
| 805 TEST_F(LockStateControllerTest, | |
| 806 DISABLED_PowerButtonPreemptsLockButton) { | |
| 807 Initialize(false, user::LOGGED_IN_USER); | 705 Initialize(false, user::LOGGED_IN_USER); |
| 808 | 706 |
| 809 // While the lock button is down, hold the power button. | 707 // While the lock button is down, hold the power button. |
| 810 PressLockButton(); | 708 PressLockButton(); |
| 811 ExpectPreLockAnimationStarted(); | 709 ExpectPreLockAnimationStarted(); |
| 710 | |
| 711 AdvancePartially(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE, 0.1f); | |
| 712 ExpectPreLockAnimationRunning(); | |
| 713 | |
| 812 PressPowerButton(); | 714 PressPowerButton(); |
| 813 ExpectPreLockAnimationStarted(); | 715 ExpectPreLockAnimationRunning(); |
| 814 | 716 |
| 815 AdvancePartially(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE, 0.5f); | 717 AdvancePartially(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE, 0.1f); |
|
Daniel Erat
2014/09/08 16:16:02
did these constants just rot due to the test being
bruthig
2014/09/09 17:32:34
0.5f might be fine, but the reason I changed it is
| |
| 718 ExpectPreLockAnimationRunning(); | |
| 816 | 719 |
| 817 // The lock timer shouldn't be stopped when the lock button is released. | 720 // The lock timer shouldn't be stopped when the lock button is released. |
| 818 ReleaseLockButton(); | 721 ReleaseLockButton(); |
| 819 ExpectPreLockAnimationStarted(); | 722 ExpectPreLockAnimationRunning(); |
| 723 | |
| 820 ReleasePowerButton(); | 724 ReleasePowerButton(); |
| 821 ExpectPreLockAnimationCancel(); | 725 ExpectPreLockAnimationCancel(); |
| 822 | 726 |
| 823 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); | 727 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); |
| 824 ExpectUnlockedState(); | 728 ExpectUnlockedState(); |
| 825 | 729 |
| 826 // Now press the power button first and then the lock button. | 730 // Now press the power button first and then the lock button. |
| 827 PressPowerButton(); | 731 PressPowerButton(); |
| 828 ExpectPreLockAnimationStarted(); | 732 ExpectPreLockAnimationStarted(); |
| 733 | |
| 734 AdvancePartially(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE, 0.1f); | |
| 735 | |
| 829 PressLockButton(); | 736 PressLockButton(); |
| 830 ExpectPreLockAnimationStarted(); | 737 ExpectPreLockAnimationRunning(); |
| 831 | 738 |
| 832 AdvancePartially(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE, 0.5f); | 739 AdvancePartially(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE, 0.1f); |
| 833 | 740 |
| 834 // Releasing the power button should stop the lock timer. | 741 // Releasing the power button should stop the lock timer. |
| 835 ReleasePowerButton(); | 742 ReleasePowerButton(); |
| 836 ExpectPreLockAnimationCancel(); | 743 ExpectPreLockAnimationCancel(); |
| 744 | |
| 745 AdvancePartially(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE, 0.1f); | |
| 746 | |
| 837 ReleaseLockButton(); | 747 ReleaseLockButton(); |
| 838 ExpectPreLockAnimationCancel(); | 748 ExpectPreLockAnimationCancel(); |
| 839 } | 749 } |
| 840 | 750 |
| 841 // When the screen is locked without going through the usual power-button | 751 // When the screen is locked without going through the usual power-button |
| 842 // slow-close path (e.g. via the wrench menu), test that we still show the | 752 // slow-close path (e.g. via the wrench menu), test that we still show the |
| 843 // fast-close animation. | 753 // fast-close animation. |
| 844 TEST_F(LockStateControllerTest, LockWithoutButton) { | 754 TEST_F(LockStateControllerTest, LockWithoutButton) { |
| 845 Initialize(false, user::LOGGED_IN_USER); | 755 Initialize(false, user::LOGGED_IN_USER); |
| 846 lock_state_controller_->OnStartingLock(); | 756 lock_state_controller_->OnStartingLock(); |
| 847 | 757 |
| 848 ExpectPreLockAnimationStarted(); | 758 ExpectPreLockAnimationStarted(); |
| 849 EXPECT_FALSE(test_api_->is_lock_cancellable()); | 759 EXPECT_FALSE(test_api_->is_lock_cancellable()); |
| 760 EXPECT_LT(0u, test_animator_->GetAnimationCount()); | |
| 850 | 761 |
| 851 // TODO(antrim): After time-faking is fixed, let the pre-lock animation | 762 test_animator_->CompleteAllAnimations(true); |
| 852 // complete here and check that delegate_->num_lock_requests() is 0 to | 763 EXPECT_EQ(0, lock_state_controller_delegate_->num_lock_requests()); |
| 853 // prevent http://crbug.com/172487 from regressing. | |
| 854 } | 764 } |
| 855 | 765 |
| 856 // When we hear that the process is exiting but we haven't had a chance to | 766 // When we hear that the process is exiting but we haven't had a chance to |
| 857 // display an animation, we should just blank the screen. | 767 // display an animation, we should just blank the screen. |
| 858 TEST_F(LockStateControllerTest, ShutdownWithoutButton) { | 768 TEST_F(LockStateControllerTest, ShutdownWithoutButton) { |
| 859 Initialize(false, user::LOGGED_IN_USER); | 769 Initialize(false, user::LOGGED_IN_USER); |
| 860 lock_state_controller_->OnAppTerminating(); | 770 lock_state_controller_->OnAppTerminating(); |
| 861 | 771 |
| 862 EXPECT_TRUE( | 772 EXPECT_TRUE( |
| 863 animator_api_->ContainersAreAnimated( | 773 test_animator_->AreContainersAnimated( |
| 864 SessionStateAnimator::kAllContainersMask, | 774 SessionStateAnimator::kAllNonRootContainersMask, |
| 865 SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY)); | 775 SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY)); |
| 866 GenerateMouseMoveEvent(); | 776 GenerateMouseMoveEvent(); |
| 867 EXPECT_FALSE(cursor_visible()); | 777 EXPECT_FALSE(cursor_visible()); |
| 868 } | 778 } |
| 869 | 779 |
| 870 // Test that we display the fast-close animation and shut down when we get an | 780 // Test that we display the fast-close animation and shut down when we get an |
| 871 // outside request to shut down (e.g. from the login or lock screen). | 781 // outside request to shut down (e.g. from the login or lock screen). |
| 872 TEST_F(LockStateControllerTest, RequestShutdownFromLoginScreen) { | 782 TEST_F(LockStateControllerTest, RequestShutdownFromLoginScreen) { |
| 873 Initialize(false, user::LOGGED_IN_NONE); | 783 Initialize(false, user::LOGGED_IN_NONE); |
| 874 CreateWindowForLockscreen(); | |
| 875 | 784 |
| 876 lock_state_controller_->RequestShutdown(); | 785 lock_state_controller_->RequestShutdown(); |
| 877 | 786 |
| 878 ExpectShutdownAnimationStarted(); | 787 ExpectShutdownAnimationStarted(); |
| 879 Advance(SessionStateAnimator::ANIMATION_SPEED_SHUTDOWN); | 788 Advance(SessionStateAnimator::ANIMATION_SPEED_SHUTDOWN); |
| 880 | 789 |
| 881 GenerateMouseMoveEvent(); | 790 GenerateMouseMoveEvent(); |
| 882 EXPECT_FALSE(cursor_visible()); | 791 EXPECT_FALSE(cursor_visible()); |
| 883 | 792 |
| 884 EXPECT_EQ(0, NumShutdownRequests()); | 793 EXPECT_EQ(0, NumShutdownRequests()); |
| 885 EXPECT_TRUE(test_api_->real_shutdown_timer_is_running()); | 794 EXPECT_TRUE(test_api_->real_shutdown_timer_is_running()); |
| 886 test_api_->trigger_real_shutdown_timeout(); | 795 test_api_->trigger_real_shutdown_timeout(); |
| 887 EXPECT_EQ(1, NumShutdownRequests()); | 796 EXPECT_EQ(1, NumShutdownRequests()); |
| 888 } | 797 } |
| 889 | 798 |
| 890 TEST_F(LockStateControllerTest, RequestShutdownFromLockScreen) { | 799 TEST_F(LockStateControllerTest, RequestShutdownFromLockScreen) { |
| 891 Initialize(false, user::LOGGED_IN_USER); | 800 Initialize(false, user::LOGGED_IN_USER); |
| 892 | 801 |
| 893 SystemLocks(); | 802 SystemLocks(); |
| 894 CreateWindowForLockscreen(); | 803 |
| 895 Advance(SessionStateAnimator::ANIMATION_SPEED_SHUTDOWN); | 804 Advance(SessionStateAnimator::ANIMATION_SPEED_SHUTDOWN); |
| 896 ExpectPastLockAnimationFinished(); | 805 ExpectPostLockAnimationFinished(); |
| 897 | 806 |
| 898 lock_state_controller_->RequestShutdown(); | 807 lock_state_controller_->RequestShutdown(); |
| 899 | 808 |
| 900 ExpectShutdownAnimationStarted(); | 809 ExpectShutdownAnimationStarted(); |
| 901 Advance(SessionStateAnimator::ANIMATION_SPEED_SHUTDOWN); | 810 Advance(SessionStateAnimator::ANIMATION_SPEED_SHUTDOWN); |
| 902 | 811 |
| 903 GenerateMouseMoveEvent(); | 812 GenerateMouseMoveEvent(); |
| 904 EXPECT_FALSE(cursor_visible()); | 813 EXPECT_FALSE(cursor_visible()); |
| 905 | 814 |
| 906 EXPECT_EQ(0, NumShutdownRequests()); | 815 EXPECT_EQ(0, NumShutdownRequests()); |
| 907 EXPECT_TRUE(test_api_->real_shutdown_timer_is_running()); | 816 EXPECT_TRUE(test_api_->real_shutdown_timer_is_running()); |
| 908 test_api_->trigger_real_shutdown_timeout(); | 817 test_api_->trigger_real_shutdown_timeout(); |
| 909 EXPECT_EQ(1, NumShutdownRequests()); | 818 EXPECT_EQ(1, NumShutdownRequests()); |
| 910 } | 819 } |
| 911 | 820 |
| 912 // TODO(antrim): Reenable this: http://crbug.com/167048 | 821 TEST_F(LockStateControllerTest, RequestAndCancelShutdownFromLockScreen) { |
| 913 TEST_F(LockStateControllerTest, | |
| 914 DISABLED_RequestAndCancelShutdownFromLockScreen) { | |
| 915 Initialize(false, user::LOGGED_IN_USER); | 822 Initialize(false, user::LOGGED_IN_USER); |
| 916 | 823 |
| 917 SystemLocks(); | 824 SystemLocks(); |
| 918 Advance(SessionStateAnimator::ANIMATION_SPEED_SHUTDOWN); | 825 Advance(SessionStateAnimator::ANIMATION_SPEED_SHUTDOWN); |
| 919 ExpectLockedState(); | 826 ExpectLockedState(); |
| 920 | 827 |
| 921 // Press the power button and check that we start the shutdown timer. | 828 // Press the power button and check that we start the shutdown timer. |
| 922 PressPowerButton(); | 829 PressPowerButton(); |
| 923 EXPECT_FALSE(test_api_->is_animating_lock()); | 830 EXPECT_FALSE(test_api_->is_animating_lock()); |
| 924 EXPECT_TRUE(test_api_->shutdown_timer_is_running()); | 831 EXPECT_TRUE(test_api_->shutdown_timer_is_running()); |
| 925 | 832 |
| 926 ExpectShutdownAnimationStarted(); | 833 ExpectShutdownAnimationStarted(); |
| 927 | 834 |
| 928 AdvancePartially(SessionStateAnimator::ANIMATION_SPEED_SHUTDOWN, 0.5f); | 835 AdvancePartially(SessionStateAnimator::ANIMATION_SPEED_SHUTDOWN, 0.5f); |
| 929 | 836 |
| 930 float grayscale_before_button_release = | |
| 931 Shell::GetPrimaryRootWindow()->layer()->layer_grayscale(); | |
| 932 | |
| 933 // Release the power button before the shutdown timer fires. | 837 // Release the power button before the shutdown timer fires. |
| 934 ReleasePowerButton(); | 838 ReleasePowerButton(); |
| 935 | 839 |
| 936 EXPECT_FALSE(test_api_->shutdown_timer_is_running()); | 840 EXPECT_FALSE(test_api_->shutdown_timer_is_running()); |
| 937 | 841 |
| 938 ExpectShutdownAnimationCancel(); | 842 ExpectShutdownAnimationCancel(); |
| 939 | 843 |
| 940 float grayscale_after_button_release = | 844 Advance(SessionStateAnimator::ANIMATION_SPEED_REVERT_SHUTDOWN); |
| 941 Shell::GetPrimaryRootWindow()->layer()->layer_grayscale(); | |
| 942 // Expect no flickering in undo animation. | |
| 943 EXPECT_EQ(grayscale_before_button_release, grayscale_after_button_release); | |
| 944 | |
| 945 Advance(SessionStateAnimator::ANIMATION_SPEED_REVERT); | |
| 946 ExpectLockedState(); | 845 ExpectLockedState(); |
| 947 } | 846 } |
| 948 | 847 |
| 949 // Test that we ignore power button presses when the screen is turned off. | 848 // Test that we ignore power button presses when the screen is turned off. |
| 950 TEST_F(LockStateControllerTest, IgnorePowerButtonIfScreenIsOff) { | 849 TEST_F(LockStateControllerTest, IgnorePowerButtonIfScreenIsOff) { |
| 951 Initialize(false, user::LOGGED_IN_USER); | 850 Initialize(false, user::LOGGED_IN_USER); |
| 952 | 851 |
| 953 // When the screen brightness is at 0%, we shouldn't do anything in response | 852 // When the screen brightness is at 0%, we shouldn't do anything in response |
| 954 // to power button presses. | 853 // to power button presses. |
| 955 controller_->OnScreenBrightnessChanged(0.0); | 854 power_button_controller_->OnScreenBrightnessChanged(0.0); |
| 956 PressPowerButton(); | 855 PressPowerButton(); |
| 957 EXPECT_FALSE(test_api_->is_animating_lock()); | 856 EXPECT_FALSE(test_api_->is_animating_lock()); |
| 958 ReleasePowerButton(); | 857 ReleasePowerButton(); |
| 959 | 858 |
| 960 // After increasing the brightness to 10%, we should start the timer like | 859 // After increasing the brightness to 10%, we should start the timer like |
| 961 // usual. | 860 // usual. |
| 962 controller_->OnScreenBrightnessChanged(10.0); | 861 power_button_controller_->OnScreenBrightnessChanged(10.0); |
| 963 PressPowerButton(); | 862 PressPowerButton(); |
| 964 EXPECT_TRUE(test_api_->is_animating_lock()); | 863 EXPECT_TRUE(test_api_->is_animating_lock()); |
| 965 ReleasePowerButton(); | 864 ReleasePowerButton(); |
| 966 } | 865 } |
| 967 | 866 |
| 968 #if defined(OS_CHROMEOS) | 867 #if defined(OS_CHROMEOS) |
| 969 TEST_F(LockStateControllerTest, HonorPowerButtonInDockedMode) { | 868 TEST_F(LockStateControllerTest, HonorPowerButtonInDockedMode) { |
| 970 ScopedVector<const ui::DisplayMode> modes; | 869 ScopedVector<const ui::DisplayMode> modes; |
| 971 modes.push_back(new ui::DisplayMode(gfx::Size(1, 1), false, 60.0f)); | 870 modes.push_back(new ui::DisplayMode(gfx::Size(1, 1), false, 60.0f)); |
| 972 | 871 |
| 973 // Create two outputs, the first internal and the second external. | 872 // Create two outputs, the first internal and the second external. |
| 974 ui::DisplayConfigurator::DisplayStateList outputs; | 873 ui::DisplayConfigurator::DisplayStateList outputs; |
| 975 ui::DisplayConfigurator::DisplayState internal_output; | 874 ui::DisplayConfigurator::DisplayState internal_output; |
| 976 ui::TestDisplaySnapshot internal_display; | 875 ui::TestDisplaySnapshot internal_display; |
| 977 internal_display.set_type(ui::DISPLAY_CONNECTION_TYPE_INTERNAL); | 876 internal_display.set_type(ui::DISPLAY_CONNECTION_TYPE_INTERNAL); |
| 978 internal_display.set_modes(modes.get()); | 877 internal_display.set_modes(modes.get()); |
| 979 internal_output.display = &internal_display; | 878 internal_output.display = &internal_display; |
| 980 outputs.push_back(internal_output); | 879 outputs.push_back(internal_output); |
| 981 | 880 |
| 982 ui::DisplayConfigurator::DisplayState external_output; | 881 ui::DisplayConfigurator::DisplayState external_output; |
| 983 ui::TestDisplaySnapshot external_display; | 882 ui::TestDisplaySnapshot external_display; |
| 984 external_display.set_type(ui::DISPLAY_CONNECTION_TYPE_HDMI); | 883 external_display.set_type(ui::DISPLAY_CONNECTION_TYPE_HDMI); |
| 985 external_display.set_modes(modes.get()); | 884 external_display.set_modes(modes.get()); |
| 986 external_output.display = &external_display; | 885 external_output.display = &external_display; |
| 987 outputs.push_back(external_output); | 886 outputs.push_back(external_output); |
| 988 | 887 |
| 989 // When all of the displays are turned off (e.g. due to user inactivity), the | 888 // When all of the displays are turned off (e.g. due to user inactivity), the |
| 990 // power button should be ignored. | 889 // power button should be ignored. |
| 991 controller_->OnScreenBrightnessChanged(0.0); | 890 power_button_controller_->OnScreenBrightnessChanged(0.0); |
| 992 static_cast<ui::TestDisplaySnapshot*>(outputs[0].display) | 891 static_cast<ui::TestDisplaySnapshot*>(outputs[0].display) |
| 993 ->set_current_mode(NULL); | 892 ->set_current_mode(NULL); |
| 994 static_cast<ui::TestDisplaySnapshot*>(outputs[1].display) | 893 static_cast<ui::TestDisplaySnapshot*>(outputs[1].display) |
| 995 ->set_current_mode(NULL); | 894 ->set_current_mode(NULL); |
| 996 controller_->OnDisplayModeChanged(outputs); | 895 power_button_controller_->OnDisplayModeChanged(outputs); |
| 997 PressPowerButton(); | 896 PressPowerButton(); |
| 998 EXPECT_FALSE(test_api_->is_animating_lock()); | 897 EXPECT_FALSE(test_api_->is_animating_lock()); |
| 999 ReleasePowerButton(); | 898 ReleasePowerButton(); |
| 1000 | 899 |
| 1001 // When the screen brightness is 0% but the external display is still turned | 900 // When the screen brightness is 0% but the external display is still turned |
| 1002 // on (indicating either docked mode or the user having manually decreased the | 901 // on (indicating either docked mode or the user having manually decreased the |
| 1003 // brightness to 0%), the power button should still be handled. | 902 // brightness to 0%), the power button should still be handled. |
| 1004 static_cast<ui::TestDisplaySnapshot*>(outputs[1].display) | 903 static_cast<ui::TestDisplaySnapshot*>(outputs[1].display) |
| 1005 ->set_current_mode(modes[0]); | 904 ->set_current_mode(modes[0]); |
| 1006 controller_->OnDisplayModeChanged(outputs); | 905 power_button_controller_->OnDisplayModeChanged(outputs); |
| 1007 PressPowerButton(); | 906 PressPowerButton(); |
| 1008 EXPECT_TRUE(test_api_->is_animating_lock()); | 907 EXPECT_TRUE(test_api_->is_animating_lock()); |
| 1009 ReleasePowerButton(); | 908 ReleasePowerButton(); |
| 1010 } | 909 } |
| 1011 #endif | 910 #endif |
| 1012 | 911 |
| 1013 // Test that hidden background appears and revers correctly on lock/cancel. | 912 // Test that hidden background appears and revers correctly on lock/cancel. |
| 1014 // TODO(antrim): Reenable this: http://crbug.com/167048 | 913 // TODO(bruthig): Reenable this: http://crbug.com/167048 |
| 1015 TEST_F(LockStateControllerTest, DISABLED_TestHiddenBackgroundLockCancel) { | 914 TEST_F(LockStateControllerTest, DISABLED_TestHiddenBackgroundLockCancel) { |
| 1016 Initialize(false, user::LOGGED_IN_USER); | 915 Initialize(false, user::LOGGED_IN_USER); |
| 1017 HideBackground(); | 916 // HideBackground(); |
|
Daniel Erat
2014/09/08 16:16:02
what's the story with these comments? we shouldn't
bruthig
2014/09/09 17:32:34
Originally I was thinking these tests would need s
| |
| 1018 | 917 |
| 1019 EXPECT_TRUE(IsBackgroundHidden()); | 918 // EXPECT_TRUE(IsBackgroundHidden()); |
| 1020 ExpectUnlockedState(); | 919 ExpectUnlockedState(); |
| 1021 PressPowerButton(); | 920 PressPowerButton(); |
| 1022 | 921 |
| 1023 ExpectPreLockAnimationStarted(); | 922 ExpectPreLockAnimationStarted(); |
| 1024 EXPECT_FALSE(IsBackgroundHidden()); | 923 // EXPECT_FALSE(IsBackgroundHidden()); |
| 1025 ExpectBackgroundIsShowing(); | 924 // ExpectBackgroundIsShowing(); |
| 1026 | 925 |
| 1027 // Forward only half way through. | 926 // Forward only half way through. |
| 1028 AdvancePartially(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE, 0.5f); | 927 AdvancePartially(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE, 0.5f); |
| 1029 | 928 |
| 1030 // Release the button before the lock timer fires. | 929 // Release the button before the lock timer fires. |
| 1031 ReleasePowerButton(); | 930 ReleasePowerButton(); |
| 1032 ExpectPreLockAnimationCancel(); | 931 ExpectPreLockAnimationCancel(); |
| 1033 ExpectBackgroundIsHiding(); | 932 // ExpectBackgroundIsHiding(); |
| 1034 EXPECT_FALSE(IsBackgroundHidden()); | 933 // EXPECT_FALSE(IsBackgroundHidden()); |
| 1035 | 934 |
| 1036 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); | 935 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); |
| 1037 | 936 |
| 1038 ExpectUnlockedState(); | 937 ExpectUnlockedState(); |
| 1039 EXPECT_TRUE(IsBackgroundHidden()); | 938 // EXPECT_TRUE(IsBackgroundHidden()); |
| 1040 } | 939 } |
| 1041 | 940 |
| 1042 // Test that hidden background appears and revers correctly on lock/unlock. | 941 // Test that hidden background appears and revers correctly on lock/unlock. |
| 1043 // TODO(antrim): Reenable this: http://crbug.com/167048 | 942 // TODO(bruthig): Reenable this: http://crbug.com/167048 |
| 1044 TEST_F(LockStateControllerTest, DISABLED_TestHiddenBackgroundLockUnlock) { | 943 TEST_F(LockStateControllerTest, DISABLED_TestHiddenBackgroundLockUnlock) { |
| 1045 Initialize(false, user::LOGGED_IN_USER); | 944 Initialize(false, user::LOGGED_IN_USER); |
| 1046 HideBackground(); | 945 // HideBackground(); |
| 1047 | 946 |
| 1048 EXPECT_TRUE(IsBackgroundHidden()); | 947 // EXPECT_TRUE(IsBackgroundHidden()); |
| 1049 ExpectUnlockedState(); | 948 ExpectUnlockedState(); |
| 1050 | 949 |
| 1051 // Press the power button and check that the lock timer is started and that we | 950 // Press the power button and check that the lock timer is started and that we |
| 1052 // start lifting the non-screen-locker containers. | 951 // start lifting the non-screen-locker containers. |
| 1053 PressPowerButton(); | 952 PressPowerButton(); |
| 1054 | 953 |
| 1055 ExpectPreLockAnimationStarted(); | 954 ExpectPreLockAnimationStarted(); |
| 1056 EXPECT_FALSE(IsBackgroundHidden()); | 955 // EXPECT_FALSE(IsBackgroundHidden()); |
| 1057 ExpectBackgroundIsShowing(); | 956 // ExpectBackgroundIsShowing(); |
| 1058 | 957 |
| 1059 Advance(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE); | 958 Advance(SessionStateAnimator::ANIMATION_SPEED_UNDOABLE); |
| 1060 | 959 |
| 1061 ExpectPreLockAnimationFinished(); | 960 ExpectPreLockAnimationFinished(); |
| 1062 | 961 |
| 1063 SystemLocks(); | 962 SystemLocks(); |
| 1064 | 963 |
| 1065 ReleasePowerButton(); | 964 ReleasePowerButton(); |
| 1066 | 965 |
| 1067 ExpectPostLockAnimationStarted(); | 966 ExpectPostLockAnimationStarted(); |
| 1068 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); | 967 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); |
| 1069 ExpectPastLockAnimationFinished(); | 968 // ExpectPastLockAnimationFinished(); |
| 1070 | 969 |
| 1071 ExpectLockedState(); | 970 ExpectLockedState(); |
| 1072 | 971 |
| 1073 SuccessfulAuthentication(NULL); | 972 SuccessfulAuthentication(NULL); |
| 1074 | 973 |
| 1075 ExpectUnlockBeforeUIDestroyedAnimationStarted(); | 974 ExpectUnlockBeforeUIDestroyedAnimationStarted(); |
| 1076 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); | 975 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); |
| 1077 ExpectUnlockBeforeUIDestroyedAnimationFinished(); | 976 ExpectUnlockBeforeUIDestroyedAnimationFinished(); |
| 1078 | 977 |
| 1079 SystemUnlocks(); | 978 SystemUnlocks(); |
| 1080 | 979 |
| 1081 ExpectUnlockAfterUIDestroyedAnimationStarted(); | 980 ExpectUnlockAfterUIDestroyedAnimationStarted(); |
| 1082 ExpectBackgroundIsHiding(); | 981 // ExpectBackgroundIsHiding(); |
| 1083 EXPECT_FALSE(IsBackgroundHidden()); | 982 // EXPECT_FALSE(IsBackgroundHidden()); |
| 1084 | 983 |
| 1085 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); | 984 Advance(SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); |
| 1086 ExpectUnlockAfterUIDestroyedAnimationFinished(); | 985 ExpectUnlockAfterUIDestroyedAnimationFinished(); |
| 1087 EXPECT_TRUE(IsBackgroundHidden()); | 986 // EXPECT_TRUE(IsBackgroundHidden()); |
| 1088 | 987 |
| 1089 ExpectUnlockedState(); | 988 ExpectUnlockedState(); |
| 1090 } | 989 } |
| 1091 | 990 |
| 991 TEST_F(LockStateControllerTest, Screenshot) { | |
| 992 test::TestScreenshotDelegate* delegate = GetScreenshotDelegate(); | |
| 993 delegate->set_can_take_screenshot(true); | |
| 994 | |
| 995 EnableMaximizeMode(false); | |
| 996 | |
| 997 // Holding volume down and pressing power takes a screenshot. | |
| 998 ASSERT_EQ(0, delegate->handle_take_screenshot_count()); | |
| 999 PressVolumeDown(); | |
| 1000 PressPowerButton(); | |
| 1001 ReleasePowerButton(); | |
| 1002 ReleaseVolumeDown(); | |
| 1003 EXPECT_EQ(0, delegate->handle_take_screenshot_count()); | |
|
Daniel Erat
2014/09/08 16:16:02
this doesn't seem to match the above comment. why
bruthig
2014/09/09 17:32:34
Done.
| |
| 1004 | |
| 1005 EnableMaximizeMode(true); | |
| 1006 | |
| 1007 // Pressing power alone does not take a screenshot. | |
| 1008 PressPowerButton(); | |
| 1009 ReleasePowerButton(); | |
| 1010 EXPECT_EQ(0, delegate->handle_take_screenshot_count()); | |
| 1011 | |
| 1012 // Press & release volume then pressing power does not take a screenshot. | |
| 1013 ASSERT_EQ(0, delegate->handle_take_screenshot_count()); | |
| 1014 PressVolumeDown(); | |
| 1015 ReleaseVolumeDown(); | |
| 1016 PressPowerButton(); | |
| 1017 ReleasePowerButton(); | |
| 1018 EXPECT_EQ(0, delegate->handle_take_screenshot_count()); | |
| 1019 | |
| 1020 // Pressing power and then volume does not take a screenshot. | |
| 1021 ASSERT_EQ(0, delegate->handle_take_screenshot_count()); | |
| 1022 PressPowerButton(); | |
| 1023 ReleasePowerButton(); | |
| 1024 PressVolumeDown(); | |
| 1025 ReleaseVolumeDown(); | |
| 1026 EXPECT_EQ(0, delegate->handle_take_screenshot_count()); | |
| 1027 | |
| 1028 // Holding volume down and pressing power takes a screenshot. | |
| 1029 ASSERT_EQ(0, delegate->handle_take_screenshot_count()); | |
| 1030 PressVolumeDown(); | |
| 1031 PressPowerButton(); | |
| 1032 ReleasePowerButton(); | |
| 1033 ReleaseVolumeDown(); | |
| 1034 EXPECT_EQ(1, delegate->handle_take_screenshot_count()); | |
| 1035 } | |
| 1036 | |
| 1037 // Tests that a lock action is cancellable when quick lock is turned on and | |
| 1038 // maximize mode is not active. | |
| 1039 TEST_F(LockStateControllerTest, QuickLockWhileNotInMaximizeMode) { | |
| 1040 Initialize(false, user::LOGGED_IN_USER); | |
| 1041 power_button_controller_->set_enable_quick_lock_for_test(true); | |
| 1042 EnableMaximizeMode(false); | |
| 1043 | |
| 1044 PressPowerButton(); | |
| 1045 | |
| 1046 ExpectPreLockAnimationStarted(); | |
| 1047 EXPECT_TRUE(test_api_->is_animating_lock()); | |
| 1048 EXPECT_TRUE(lock_state_controller_->CanCancelLockAnimation()); | |
| 1049 | |
| 1050 ReleasePowerButton(); | |
| 1051 | |
| 1052 EXPECT_EQ(0, lock_state_controller_delegate_->num_lock_requests()); | |
| 1053 } | |
| 1054 | |
| 1055 // Tests that a lock action is not cancellable when quick lock is turned on and | |
| 1056 // maximize mode is active. | |
| 1057 TEST_F(LockStateControllerTest, QuickLockWhileInMaximizeMode) { | |
| 1058 Initialize(false, user::LOGGED_IN_USER); | |
| 1059 power_button_controller_->set_enable_quick_lock_for_test(true); | |
| 1060 EnableMaximizeMode(true); | |
| 1061 | |
| 1062 PressPowerButton(); | |
| 1063 | |
| 1064 ExpectPreLockAnimationStarted(); | |
| 1065 EXPECT_TRUE(test_api_->is_animating_lock()); | |
| 1066 EXPECT_FALSE(lock_state_controller_->CanCancelLockAnimation()); | |
| 1067 | |
| 1068 ReleasePowerButton(); | |
| 1069 | |
| 1070 ExpectPreLockAnimationStarted(); | |
| 1071 | |
| 1072 test_animator_->CompleteAllAnimations(true); | |
| 1073 EXPECT_EQ(1, lock_state_controller_delegate_->num_lock_requests()); | |
| 1074 } | |
| 1075 | |
| 1092 } // namespace test | 1076 } // namespace test |
| 1093 } // namespace ash | 1077 } // namespace ash |
| OLD | NEW |