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

Unified Diff: ui/compositor/layer_animator_unittest.cc

Issue 2854653003: [Night Light] Backend ui::Layer work (Closed)
Patch Set: Created 3 years, 8 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 53fec5f0e7ee0d798167cd02e72a85e664837241..4b9575b4ba2cd2146217c5a2346ee2695a5dc7c4 100644
--- a/ui/compositor/layer_animator_unittest.cc
+++ b/ui/compositor/layer_animator_unittest.cc
@@ -2251,6 +2251,39 @@ TEST(LayerAnimatorTest, Color) {
ColorToString(delegate.GetColorForAnimation()));
}
+// Verifies temperature property is modified appropriately.
+TEST(LayerAnimatorTest, Temperature) {
+ TestLayerAnimationDelegate delegate;
+ scoped_refptr<LayerAnimator> animator(CreateDefaultTestAnimator(&delegate));
+
+ float start_temperature = 0.0f;
+ float middle_temperature = 0.5f;
+ float target_temperature = 1.0f;
+
+ base::TimeDelta delta = base::TimeDelta::FromSeconds(1);
+
+ delegate.SetTemperatureFromAnimation(start_temperature);
+
+ animator->ScheduleAnimation(new LayerAnimationSequence(
+ LayerAnimationElement::CreateTemperatureElement(target_temperature,
+ delta)));
+
+ EXPECT_TRUE(animator->is_animating());
+ EXPECT_EQ(start_temperature, delegate.GetTemperatureFromAnimation());
+
+ base::TimeTicks start_time = animator->last_step_time();
+
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(500));
+
+ EXPECT_TRUE(animator->is_animating());
+ EXPECT_EQ(middle_temperature, delegate.GetTemperatureFromAnimation());
+
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
+
+ EXPECT_FALSE(animator->is_animating());
+ EXPECT_EQ(target_temperature, delegate.GetTemperatureFromAnimation());
+}
+
// Verifies SchedulePauseForProperties().
TEST(LayerAnimatorTest, SchedulePauseForProperties) {
scoped_refptr<LayerAnimator> animator(CreateDefaultTestAnimator());
« 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