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

Unified Diff: ash/wm/power_button_controller_unittest.cc

Issue 10914016: ash: Extract animator from PowerButtonController (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: restore ASH_EXPORT Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/power_button_controller.cc ('k') | ash/wm/session_state_animator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 148d4c854ac251715bed1f91433c2f36cf146f41..8eb7d54392d2d3f88db31face5ebefca15ffb7c0 100644
--- a/ash/wm/power_button_controller_unittest.cc
+++ b/ash/wm/power_button_controller_unittest.cc
@@ -91,8 +91,8 @@ TEST_F(PowerButtonControllerTest, LegacyLockAndShutDown) {
controller_->OnPowerButtonEvent(true, base::TimeTicks::Now());
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
- PowerButtonController::ANIMATION_SLOW_CLOSE));
+ internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
+ internal::SessionStateAnimator::ANIMATION_SLOW_CLOSE));
EXPECT_TRUE(test_api_->BlackLayerIsVisible());
EXPECT_FALSE(test_api_->hide_black_layer_timer_is_running());
EXPECT_FALSE(test_api_->lock_timer_is_running());
@@ -102,23 +102,23 @@ TEST_F(PowerButtonControllerTest, LegacyLockAndShutDown) {
controller_->OnStartingLock();
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::LAUNCHER,
- PowerButtonController::ANIMATION_HIDE));
+ internal::SessionStateAnimator::LAUNCHER,
+ internal::SessionStateAnimator::ANIMATION_HIDE));
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
- PowerButtonController::ANIMATION_FAST_CLOSE));
+ internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
+ internal::SessionStateAnimator::ANIMATION_FAST_CLOSE));
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::LOCK_SCREEN_CONTAINERS,
- PowerButtonController::ANIMATION_HIDE));
+ internal::SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
+ internal::SessionStateAnimator::ANIMATION_HIDE));
// Notify that the lock window is visible. We should make it fade in.
controller_->OnLockStateChanged(true);
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::GetAllLockScreenContainersMask(),
- PowerButtonController::ANIMATION_FADE_IN));
+ internal::SessionStateAnimator::kAllLockScreenContainersMask,
+ internal::SessionStateAnimator::ANIMATION_FADE_IN));
// We shouldn't progress towards the shutdown state, however.
EXPECT_FALSE(test_api_->lock_to_shutdown_timer_is_running());
@@ -140,8 +140,8 @@ TEST_F(PowerButtonControllerTest, LegacyLockAndShutDown) {
// containers are animated during shutdown.
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::GetAllLockScreenContainersMask(),
- PowerButtonController::ANIMATION_FAST_CLOSE));
+ internal::SessionStateAnimator::kAllLockScreenContainersMask,
+ internal::SessionStateAnimator::ANIMATION_FAST_CLOSE));
// Make sure a mouse move event won't show the cursor.
GenerateMouseMoveEvent();
EXPECT_FALSE(cursor_visible());
@@ -184,8 +184,8 @@ TEST_F(PowerButtonControllerTest, ShutdownWhenNotLoggedIn) {
EXPECT_TRUE(test_api_->shutdown_timer_is_running());
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::GetAllContainersMask(),
- PowerButtonController::ANIMATION_SLOW_CLOSE));
+ internal::SessionStateAnimator::kAllContainersMask,
+ internal::SessionStateAnimator::ANIMATION_SLOW_CLOSE));
EXPECT_TRUE(test_api_->BlackLayerIsVisible());
// Release the power button before the shutdown timer fires.
@@ -193,14 +193,14 @@ TEST_F(PowerButtonControllerTest, ShutdownWhenNotLoggedIn) {
EXPECT_FALSE(test_api_->shutdown_timer_is_running());
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::GetAllContainersMask(),
- PowerButtonController::ANIMATION_UNDO_SLOW_CLOSE));
+ internal::SessionStateAnimator::kAllContainersMask,
+ internal::SessionStateAnimator::ANIMATION_UNDO_SLOW_CLOSE));
EXPECT_TRUE(test_api_->BlackLayerIsVisible());
// We should re-hide the black layer after waiting long enough for
// the animation to finish.
EXPECT_TRUE(test_api_->hide_black_layer_timer_is_running());
- test_api_->trigger_hide_black_layer_timeout();
+ test_api_->TriggerHideBlackLayerTimeout();
EXPECT_FALSE(test_api_->BlackLayerIsVisible());
// Press the button again and make the shutdown timeout fire this time.
@@ -212,13 +212,13 @@ TEST_F(PowerButtonControllerTest, ShutdownWhenNotLoggedIn) {
EXPECT_EQ(0, delegate_->num_shutdown_requests());
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::LAUNCHER |
- PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
- PowerButtonController::ANIMATION_HIDE));
+ internal::SessionStateAnimator::LAUNCHER |
+ internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
+ internal::SessionStateAnimator::ANIMATION_HIDE));
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::GetAllLockScreenContainersMask(),
- PowerButtonController::ANIMATION_FAST_CLOSE));
+ internal::SessionStateAnimator::kAllLockScreenContainersMask,
+ internal::SessionStateAnimator::ANIMATION_FAST_CLOSE));
// When the timout fires, we should request a shutdown.
test_api_->trigger_real_shutdown_timeout();
@@ -237,8 +237,8 @@ TEST_F(PowerButtonControllerTest, LockAndUnlock) {
// logging-in animation.
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::LOCK_SCREEN_CONTAINERS,
- PowerButtonController::ANIMATION_RESTORE));
+ internal::SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
+ internal::SessionStateAnimator::ANIMATION_RESTORE));
// Press the power button and check that the lock timer is started and that we
// start scaling the non-screen-locker containers.
@@ -247,8 +247,8 @@ TEST_F(PowerButtonControllerTest, LockAndUnlock) {
EXPECT_FALSE(test_api_->shutdown_timer_is_running());
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
- PowerButtonController::ANIMATION_SLOW_CLOSE));
+ internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
+ internal::SessionStateAnimator::ANIMATION_SLOW_CLOSE));
EXPECT_TRUE(test_api_->BlackLayerIsVisible());
// Release the button before the lock timer fires.
@@ -256,11 +256,11 @@ TEST_F(PowerButtonControllerTest, LockAndUnlock) {
EXPECT_FALSE(test_api_->lock_timer_is_running());
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
- PowerButtonController::ANIMATION_UNDO_SLOW_CLOSE));
+ internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
+ internal::SessionStateAnimator::ANIMATION_UNDO_SLOW_CLOSE));
EXPECT_TRUE(test_api_->BlackLayerIsVisible());
EXPECT_TRUE(test_api_->hide_black_layer_timer_is_running());
- test_api_->trigger_hide_black_layer_timeout();
+ test_api_->TriggerHideBlackLayerTimeout();
EXPECT_FALSE(test_api_->BlackLayerIsVisible());
// Press the button and fire the lock timer. We should request that the
@@ -272,31 +272,31 @@ TEST_F(PowerButtonControllerTest, LockAndUnlock) {
EXPECT_EQ(1, delegate_->num_lock_requests());
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
- PowerButtonController::ANIMATION_SLOW_CLOSE));
+ internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
+ internal::SessionStateAnimator::ANIMATION_SLOW_CLOSE));
EXPECT_TRUE(test_api_->BlackLayerIsVisible());
// Notify that we locked successfully.
controller_->OnStartingLock();
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::LAUNCHER,
- PowerButtonController::ANIMATION_HIDE));
+ internal::SessionStateAnimator::LAUNCHER,
+ internal::SessionStateAnimator::ANIMATION_HIDE));
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
- PowerButtonController::ANIMATION_FAST_CLOSE));
+ internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
+ internal::SessionStateAnimator::ANIMATION_FAST_CLOSE));
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::LOCK_SCREEN_CONTAINERS,
- PowerButtonController::ANIMATION_HIDE));
+ internal::SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
+ internal::SessionStateAnimator::ANIMATION_HIDE));
// Notify that the lock window is visible. We should make it fade in.
controller_->OnLockStateChanged(true);
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::GetAllLockScreenContainersMask(),
- PowerButtonController::ANIMATION_FADE_IN));
+ internal::SessionStateAnimator::kAllLockScreenContainersMask,
+ internal::SessionStateAnimator::ANIMATION_FADE_IN));
// When we release the power button, the lock-to-shutdown timer should be
// stopped.
@@ -309,10 +309,10 @@ TEST_F(PowerButtonControllerTest, LockAndUnlock) {
controller_->OnLockStateChanged(false);
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::DESKTOP_BACKGROUND |
- PowerButtonController::LAUNCHER |
- PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
- PowerButtonController::ANIMATION_RESTORE));
+ internal::SessionStateAnimator::DESKTOP_BACKGROUND |
+ internal::SessionStateAnimator::LAUNCHER |
+ internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
+ internal::SessionStateAnimator::ANIMATION_RESTORE));
EXPECT_FALSE(test_api_->BlackLayerIsVisible());
}
@@ -337,8 +337,8 @@ TEST_F(PowerButtonControllerTest, LockToShutdown) {
EXPECT_TRUE(test_api_->shutdown_timer_is_running());
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::GetAllContainersMask(),
- PowerButtonController::ANIMATION_SLOW_CLOSE));
+ internal::SessionStateAnimator::kAllContainersMask,
+ internal::SessionStateAnimator::ANIMATION_SLOW_CLOSE));
// Fire the shutdown timeout and check that we request shutdown.
test_api_->trigger_shutdown_timeout();
@@ -363,10 +363,10 @@ TEST_F(PowerButtonControllerTest, LockFail) {
EXPECT_TRUE(test_api_->lock_timer_is_running());
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::DESKTOP_BACKGROUND |
- PowerButtonController::LAUNCHER |
- PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
- PowerButtonController::ANIMATION_RESTORE));
+ internal::SessionStateAnimator::DESKTOP_BACKGROUND |
+ internal::SessionStateAnimator::LAUNCHER |
+ internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
+ internal::SessionStateAnimator::ANIMATION_RESTORE));
EXPECT_TRUE(test_api_->BlackLayerIsVisible());
test_api_->trigger_lock_timeout();
EXPECT_EQ(1, delegate_->num_lock_requests());
@@ -380,8 +380,8 @@ TEST_F(PowerButtonControllerTest, LockFail) {
test_api_->trigger_lock_fail_timeout();
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
- PowerButtonController::ANIMATION_RESTORE));
+ internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
+ internal::SessionStateAnimator::ANIMATION_RESTORE));
EXPECT_FALSE(test_api_->BlackLayerIsVisible());
}
@@ -427,8 +427,8 @@ TEST_F(PowerButtonControllerTest, LockButtonBasic) {
EXPECT_TRUE(test_api_->lock_timer_is_running());
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
- PowerButtonController::ANIMATION_SLOW_CLOSE));
+ internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
+ internal::SessionStateAnimator::ANIMATION_SLOW_CLOSE));
EXPECT_TRUE(test_api_->BlackLayerIsVisible());
// If the button is released immediately, we shouldn't lock the screen.
@@ -436,11 +436,11 @@ TEST_F(PowerButtonControllerTest, LockButtonBasic) {
EXPECT_FALSE(test_api_->lock_timer_is_running());
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
- PowerButtonController::ANIMATION_UNDO_SLOW_CLOSE));
+ internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
+ internal::SessionStateAnimator::ANIMATION_UNDO_SLOW_CLOSE));
EXPECT_TRUE(test_api_->BlackLayerIsVisible());
EXPECT_TRUE(test_api_->hide_black_layer_timer_is_running());
- test_api_->trigger_hide_black_layer_timeout();
+ test_api_->TriggerHideBlackLayerTimeout();
EXPECT_FALSE(test_api_->BlackLayerIsVisible());
EXPECT_EQ(0, delegate_->num_lock_requests());
@@ -505,8 +505,8 @@ TEST_F(PowerButtonControllerTest, LockWithoutButton) {
controller_->OnStartingLock();
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
- PowerButtonController::ANIMATION_FAST_CLOSE));
+ internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
+ internal::SessionStateAnimator::ANIMATION_FAST_CLOSE));
EXPECT_TRUE(test_api_->BlackLayerIsVisible());
}
@@ -517,8 +517,8 @@ TEST_F(PowerButtonControllerTest, ShutdownWithoutButton) {
controller_->OnAppTerminating();
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::GetAllContainersMask(),
- PowerButtonController::ANIMATION_HIDE));
+ internal::SessionStateAnimator::kAllContainersMask,
+ internal::SessionStateAnimator::ANIMATION_HIDE));
EXPECT_TRUE(test_api_->BlackLayerIsVisible());
GenerateMouseMoveEvent();
EXPECT_FALSE(cursor_visible());
@@ -531,12 +531,12 @@ TEST_F(PowerButtonControllerTest, RequestShutdownFromLoginScreen) {
controller_->RequestShutdown();
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
- PowerButtonController::ANIMATION_HIDE));
+ internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
+ internal::SessionStateAnimator::ANIMATION_HIDE));
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::GetAllLockScreenContainersMask(),
- PowerButtonController::ANIMATION_FAST_CLOSE));
+ internal::SessionStateAnimator::kAllLockScreenContainersMask,
+ internal::SessionStateAnimator::ANIMATION_FAST_CLOSE));
EXPECT_TRUE(test_api_->BlackLayerIsVisible());
GenerateMouseMoveEvent();
EXPECT_FALSE(cursor_visible());
@@ -553,12 +553,12 @@ TEST_F(PowerButtonControllerTest, RequestShutdownFromLockScreen) {
controller_->RequestShutdown();
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
- PowerButtonController::ANIMATION_HIDE));
+ internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
+ internal::SessionStateAnimator::ANIMATION_HIDE));
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::GetAllLockScreenContainersMask(),
- PowerButtonController::ANIMATION_FAST_CLOSE));
+ internal::SessionStateAnimator::kAllLockScreenContainersMask,
+ internal::SessionStateAnimator::ANIMATION_FAST_CLOSE));
EXPECT_TRUE(test_api_->BlackLayerIsVisible());
GenerateMouseMoveEvent();
EXPECT_FALSE(cursor_visible());
@@ -579,8 +579,8 @@ TEST_F(PowerButtonControllerTest, RequestAndCancelShutdownFromLockScreen) {
EXPECT_TRUE(test_api_->shutdown_timer_is_running());
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::GetAllContainersMask(),
- PowerButtonController::ANIMATION_SLOW_CLOSE));
+ internal::SessionStateAnimator::kAllContainersMask,
+ internal::SessionStateAnimator::ANIMATION_SLOW_CLOSE));
EXPECT_TRUE(test_api_->BlackLayerIsVisible());
// Release the power button before the shutdown timer fires.
@@ -588,12 +588,12 @@ TEST_F(PowerButtonControllerTest, RequestAndCancelShutdownFromLockScreen) {
EXPECT_FALSE(test_api_->shutdown_timer_is_running());
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::GetAllLockScreenContainersMask(),
- PowerButtonController::ANIMATION_UNDO_SLOW_CLOSE));
+ internal::SessionStateAnimator::kAllLockScreenContainersMask,
+ internal::SessionStateAnimator::ANIMATION_UNDO_SLOW_CLOSE));
EXPECT_TRUE(
test_api_->ContainersAreAnimated(
- PowerButtonController::DESKTOP_BACKGROUND,
- PowerButtonController::ANIMATION_RESTORE));
+ internal::SessionStateAnimator::DESKTOP_BACKGROUND,
+ internal::SessionStateAnimator::ANIMATION_RESTORE));
EXPECT_TRUE(test_api_->BlackLayerIsVisible());
}
« no previous file with comments | « ash/wm/power_button_controller.cc ('k') | ash/wm/session_state_animator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698