Index: ash/wm/power_button_controller_unittest.cc |
diff --git a/ash/wm/power_button_controller_unittest.cc b/ash/wm/power_button_controller_unittest.cc |
index b84a0717c6ddd56a4854332de9f6a2291b03334b..d22f22ba5444bd252e3dc263d3b843182064139f 100644 |
--- a/ash/wm/power_button_controller_unittest.cc |
+++ b/ash/wm/power_button_controller_unittest.cc |
@@ -7,6 +7,7 @@ |
#include "ash/shell.h" |
#include "ash/test/ash_test_base.h" |
#include "ash/wm/cursor_manager.h" |
+#include "ash/wm/session_state_animator.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/time.h" |
#include "ui/aura/env.h" |
@@ -84,8 +85,8 @@ TEST_F(PowerButtonControllerTest, LegacyLockAndShutDown) { |
controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
- PowerButtonController::ANIMATION_SLOW_CLOSE)); |
+ SessionStateAnimator::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
+ SessionStateAnimator::SLOW_CLOSE)); |
EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); |
EXPECT_FALSE(test_api_->hide_background_layer_timer_is_running()); |
EXPECT_FALSE(test_api_->lock_timer_is_running()); |
@@ -95,19 +96,19 @@ TEST_F(PowerButtonControllerTest, LegacyLockAndShutDown) { |
controller_->OnStartingLock(); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
- PowerButtonController::ANIMATION_FAST_CLOSE)); |
+ SessionStateAnimator::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
+ SessionStateAnimator::FAST_CLOSE)); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::SCREEN_LOCKER_CONTAINERS, |
- PowerButtonController::ANIMATION_HIDE)); |
+ SessionStateAnimator::SCREEN_LOCKER_CONTAINERS, |
+ SessionStateAnimator::HIDE)); |
// Notify that the lock window is visible. We should make it fade in. |
controller_->OnLockStateChanged(true); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
- PowerButtonController::ANIMATION_FADE_IN)); |
+ SessionStateAnimator::SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
+ SessionStateAnimator::FADE_IN)); |
// We shouldn't progress towards the shutdown state, however. |
EXPECT_FALSE(test_api_->lock_to_shutdown_timer_is_running()); |
@@ -119,8 +120,8 @@ TEST_F(PowerButtonControllerTest, LegacyLockAndShutDown) { |
EXPECT_EQ(0, delegate_->num_shutdown_requests()); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::ALL_CONTAINERS, |
- PowerButtonController::ANIMATION_FAST_CLOSE)); |
+ SessionStateAnimator::ALL_CONTAINERS, |
+ SessionStateAnimator::FAST_CLOSE)); |
EXPECT_FALSE(cursor_visible()); |
EXPECT_TRUE(test_api_->real_shutdown_timer_is_running()); |
test_api_->trigger_real_shutdown_timeout(); |
@@ -161,8 +162,8 @@ TEST_F(PowerButtonControllerTest, ShutdownWhenNotLoggedIn) { |
EXPECT_TRUE(test_api_->shutdown_timer_is_running()); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::ALL_CONTAINERS, |
- PowerButtonController::ANIMATION_SLOW_CLOSE)); |
+ SessionStateAnimator::ALL_CONTAINERS, |
+ SessionStateAnimator::SLOW_CLOSE)); |
EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); |
// Release the power button before the shutdown timer fires. |
@@ -170,8 +171,8 @@ TEST_F(PowerButtonControllerTest, ShutdownWhenNotLoggedIn) { |
EXPECT_FALSE(test_api_->shutdown_timer_is_running()); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::ALL_CONTAINERS, |
- PowerButtonController::ANIMATION_UNDO_SLOW_CLOSE)); |
+ SessionStateAnimator::ALL_CONTAINERS, |
+ SessionStateAnimator::UNDO_SLOW_CLOSE)); |
EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); |
// We should re-hide the black background layer after waiting long enough for |
@@ -189,12 +190,12 @@ TEST_F(PowerButtonControllerTest, ShutdownWhenNotLoggedIn) { |
EXPECT_EQ(0, delegate_->num_shutdown_requests()); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
- PowerButtonController::ANIMATION_HIDE)); |
+ SessionStateAnimator::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
+ SessionStateAnimator::HIDE)); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
- PowerButtonController::ANIMATION_FAST_CLOSE)); |
+ SessionStateAnimator::SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
+ SessionStateAnimator::FAST_CLOSE)); |
// When the timout fires, we should request a shutdown. |
test_api_->trigger_real_shutdown_timeout(); |
@@ -213,8 +214,8 @@ TEST_F(PowerButtonControllerTest, LockAndUnlock) { |
// logging-in animation. |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::SCREEN_LOCKER_CONTAINERS, |
- PowerButtonController::ANIMATION_RESTORE)); |
+ SessionStateAnimator::SCREEN_LOCKER_CONTAINERS, |
+ SessionStateAnimator::RESTORE)); |
// Press the power button and check that the lock timer is started and that we |
// start scaling the non-screen-locker containers. |
@@ -223,8 +224,8 @@ TEST_F(PowerButtonControllerTest, LockAndUnlock) { |
EXPECT_FALSE(test_api_->shutdown_timer_is_running()); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
- PowerButtonController::ANIMATION_SLOW_CLOSE)); |
+ SessionStateAnimator::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
+ SessionStateAnimator::SLOW_CLOSE)); |
EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); |
// Release the button before the lock timer fires. |
@@ -232,8 +233,8 @@ TEST_F(PowerButtonControllerTest, LockAndUnlock) { |
EXPECT_FALSE(test_api_->lock_timer_is_running()); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
- PowerButtonController::ANIMATION_UNDO_SLOW_CLOSE)); |
+ SessionStateAnimator::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
+ SessionStateAnimator::UNDO_SLOW_CLOSE)); |
EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); |
EXPECT_TRUE(test_api_->hide_background_layer_timer_is_running()); |
test_api_->trigger_hide_background_layer_timeout(); |
@@ -248,27 +249,27 @@ TEST_F(PowerButtonControllerTest, LockAndUnlock) { |
EXPECT_EQ(1, delegate_->num_lock_requests()); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
- PowerButtonController::ANIMATION_SLOW_CLOSE)); |
+ SessionStateAnimator::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
+ SessionStateAnimator::SLOW_CLOSE)); |
EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); |
// Notify that we locked successfully. |
controller_->OnStartingLock(); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
- PowerButtonController::ANIMATION_FAST_CLOSE)); |
+ SessionStateAnimator::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
+ SessionStateAnimator::FAST_CLOSE)); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::SCREEN_LOCKER_CONTAINERS, |
- PowerButtonController::ANIMATION_HIDE)); |
+ SessionStateAnimator::SCREEN_LOCKER_CONTAINERS, |
+ SessionStateAnimator::HIDE)); |
// Notify that the lock window is visible. We should make it fade in. |
controller_->OnLockStateChanged(true); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
- PowerButtonController::ANIMATION_FADE_IN)); |
+ SessionStateAnimator::SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
+ SessionStateAnimator::FADE_IN)); |
// When we release the power button, the lock-to-shutdown timer should be |
// stopped. |
@@ -281,8 +282,8 @@ TEST_F(PowerButtonControllerTest, LockAndUnlock) { |
controller_->OnLockStateChanged(false); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
- PowerButtonController::ANIMATION_RESTORE)); |
+ SessionStateAnimator::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
+ SessionStateAnimator::RESTORE)); |
EXPECT_FALSE(test_api_->BackgroundLayerIsVisible()); |
} |
@@ -307,8 +308,8 @@ TEST_F(PowerButtonControllerTest, LockToShutdown) { |
EXPECT_TRUE(test_api_->shutdown_timer_is_running()); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::ALL_CONTAINERS, |
- PowerButtonController::ANIMATION_SLOW_CLOSE)); |
+ SessionStateAnimator::ALL_CONTAINERS, |
+ SessionStateAnimator::SLOW_CLOSE)); |
// Fire the shutdown timeout and check that we request shutdown. |
test_api_->trigger_shutdown_timeout(); |
@@ -333,8 +334,8 @@ TEST_F(PowerButtonControllerTest, LockFail) { |
EXPECT_TRUE(test_api_->lock_timer_is_running()); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
- PowerButtonController::ANIMATION_RESTORE)); |
+ SessionStateAnimator::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
+ SessionStateAnimator::RESTORE)); |
EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); |
test_api_->trigger_lock_timeout(); |
EXPECT_EQ(1, delegate_->num_lock_requests()); |
@@ -348,8 +349,8 @@ TEST_F(PowerButtonControllerTest, LockFail) { |
test_api_->trigger_lock_fail_timeout(); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
- PowerButtonController::ANIMATION_RESTORE)); |
+ SessionStateAnimator::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
+ SessionStateAnimator::RESTORE)); |
EXPECT_FALSE(test_api_->BackgroundLayerIsVisible()); |
} |
@@ -395,8 +396,8 @@ TEST_F(PowerButtonControllerTest, LockButtonBasic) { |
EXPECT_TRUE(test_api_->lock_timer_is_running()); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
- PowerButtonController::ANIMATION_SLOW_CLOSE)); |
+ SessionStateAnimator::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
+ SessionStateAnimator::SLOW_CLOSE)); |
EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); |
// If the button is released immediately, we shouldn't lock the screen. |
@@ -404,8 +405,8 @@ TEST_F(PowerButtonControllerTest, LockButtonBasic) { |
EXPECT_FALSE(test_api_->lock_timer_is_running()); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
- PowerButtonController::ANIMATION_UNDO_SLOW_CLOSE)); |
+ SessionStateAnimator::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
+ SessionStateAnimator::UNDO_SLOW_CLOSE)); |
EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); |
EXPECT_TRUE(test_api_->hide_background_layer_timer_is_running()); |
test_api_->trigger_hide_background_layer_timeout(); |
@@ -473,8 +474,8 @@ TEST_F(PowerButtonControllerTest, LockWithoutButton) { |
controller_->OnStartingLock(); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
- PowerButtonController::ANIMATION_FAST_CLOSE)); |
+ SessionStateAnimator::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
+ SessionStateAnimator::FAST_CLOSE)); |
EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); |
} |
@@ -485,8 +486,8 @@ TEST_F(PowerButtonControllerTest, ShutdownWithoutButton) { |
controller_->OnAppTerminating(); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::ALL_CONTAINERS, |
- PowerButtonController::ANIMATION_HIDE)); |
+ SessionStateAnimator::ALL_CONTAINERS, |
+ SessionStateAnimator::HIDE)); |
EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); |
EXPECT_FALSE(cursor_visible()); |
} |
@@ -498,12 +499,12 @@ TEST_F(PowerButtonControllerTest, RequestShutdownFromLoginScreen) { |
controller_->RequestShutdown(); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
- PowerButtonController::ANIMATION_HIDE)); |
+ SessionStateAnimator::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
+ SessionStateAnimator::HIDE)); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
- PowerButtonController::ANIMATION_FAST_CLOSE)); |
+ SessionStateAnimator::SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
+ SessionStateAnimator::FAST_CLOSE)); |
EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); |
EXPECT_FALSE(cursor_visible()); |
@@ -519,12 +520,12 @@ TEST_F(PowerButtonControllerTest, RequestShutdownFromLockScreen) { |
controller_->RequestShutdown(); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
- PowerButtonController::ANIMATION_HIDE)); |
+ SessionStateAnimator::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
+ SessionStateAnimator::HIDE)); |
EXPECT_TRUE( |
test_api_->ContainerGroupIsAnimated( |
- PowerButtonController::SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
- PowerButtonController::ANIMATION_FAST_CLOSE)); |
+ SessionStateAnimator::SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
+ SessionStateAnimator::FAST_CLOSE)); |
EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); |
EXPECT_FALSE(cursor_visible()); |