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

Unified Diff: ui/compositor/layer_animator_unittest.cc

Issue 10800020: Add brightness/grayscale animations and use them for OOBE boot transition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix hide animation Created 8 years, 5 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 | « ui/compositor/layer_animator.cc ('k') | ui/compositor/test/test_layer_animation_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer_animator_unittest.cc
diff --git a/ui/compositor/layer_animator_unittest.cc b/ui/compositor/layer_animator_unittest.cc
index b2cade28ac7430536fe5dcd33a0f494fa5844f3c..beea4ba3c93234ba92561f6c15defbb2e985ec4f 100644
--- a/ui/compositor/layer_animator_unittest.cc
+++ b/ui/compositor/layer_animator_unittest.cc
@@ -1118,4 +1118,46 @@ TEST(LayerAnimatorTest, GetTargetOpacity) {
}
}
+// Verifies GetTargetBrightness() works when multiple sequences are scheduled.
+TEST(LayerAnimatorTest, GetTargetBrightness) {
+ scoped_ptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator());
+ animator->set_preemption_strategy(LayerAnimator::ENQUEUE_NEW_ANIMATION);
+ animator->set_disable_timer_for_test(true);
+ TestLayerAnimationDelegate delegate;
+ animator->SetDelegate(&delegate);
+
+ delegate.SetBrightnessFromAnimation(0.0);
+
+ {
+ ScopedLayerAnimationSettings settings(animator.get());
+ animator->SetBrightness(0.5);
+ EXPECT_EQ(0.5, animator->GetTargetBrightness());
+
+ // Because the strategy is ENQUEUE_NEW_ANIMATION the target should now be 1.
+ animator->SetBrightness(1.0);
+ EXPECT_EQ(1.0, animator->GetTargetBrightness());
+ }
+}
+
+// Verifies GetTargetGrayscale() works when multiple sequences are scheduled.
+TEST(LayerAnimatorTest, GetTargetGrayscale) {
+ scoped_ptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator());
+ animator->set_preemption_strategy(LayerAnimator::ENQUEUE_NEW_ANIMATION);
+ animator->set_disable_timer_for_test(true);
+ TestLayerAnimationDelegate delegate;
+ animator->SetDelegate(&delegate);
+
+ delegate.SetGrayscaleFromAnimation(0.0);
+
+ {
+ ScopedLayerAnimationSettings settings(animator.get());
+ animator->SetGrayscale(0.5);
+ EXPECT_EQ(0.5, animator->GetTargetGrayscale());
+
+ // Because the strategy is ENQUEUE_NEW_ANIMATION the target should now be 1.
+ animator->SetGrayscale(1.0);
+ EXPECT_EQ(1.0, animator->GetTargetGrayscale());
+ }
+}
+
} // namespace ui
« no previous file with comments | « ui/compositor/layer_animator.cc ('k') | ui/compositor/test/test_layer_animation_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698