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

Side by Side Diff: Source/core/animation/AnimationClockTest.cpp

Issue 135693003: Defer starting of animations until after compositing update (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Advance animation clock after minimum delay. Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 30 matching lines...) Expand all
41 class AnimationAnimationClockTest : public ::testing::Test { 41 class AnimationAnimationClockTest : public ::testing::Test {
42 protected: 42 protected:
43 virtual void SetUp() 43 virtual void SetUp()
44 { 44 {
45 animationClock = AnimationClock::create(mockTimeFunction); 45 animationClock = AnimationClock::create(mockTimeFunction);
46 mockTime = 200; 46 mockTime = 200;
47 } 47 }
48 48
49 static double mockTimeFunction() 49 static double mockTimeFunction()
50 { 50 {
51 return mockTime++; 51 return mockTime;
52 } 52 }
53 53
54 static double mockTime; 54 static double mockTime;
55 OwnPtr<AnimationClock> animationClock; 55 OwnPtr<AnimationClock> animationClock;
56 }; 56 };
57 57
58 double AnimationAnimationClockTest::mockTime; 58 double AnimationAnimationClockTest::mockTime;
59 59
60 TEST_F(AnimationAnimationClockTest, CurrentTime) 60 TEST_F(AnimationAnimationClockTest, CurrentTime)
61 { 61 {
62 // Current time should not advance until minTimeBeforeUnsynchronizedTick has elapsed
62 EXPECT_EQ(200, animationClock->currentTime()); 63 EXPECT_EQ(200, animationClock->currentTime());
64 mockTime = 200 + 0.0025;
63 EXPECT_EQ(200, animationClock->currentTime()); 65 EXPECT_EQ(200, animationClock->currentTime());
64 animationClock->unfreeze(); 66
65 EXPECT_EQ(201, animationClock->currentTime()); 67 mockTime = 200 + 0.005;
66 EXPECT_EQ(201, animationClock->currentTime()); 68 EXPECT_EQ(mockTime, animationClock->currentTime());
67 } 69 }
68 70
69 TEST_F(AnimationAnimationClockTest, UpdateTime) 71 TEST_F(AnimationAnimationClockTest, UpdateTime)
70 { 72 {
71 animationClock->updateTime(100); 73 animationClock->updateTime(100);
72 EXPECT_EQ(100, animationClock->currentTime()); 74 EXPECT_EQ(100, animationClock->currentTime());
75 mockTime = 200;
73 EXPECT_EQ(100, animationClock->currentTime()); 76 EXPECT_EQ(100, animationClock->currentTime());
74 animationClock->updateTime(150); 77
75 EXPECT_EQ(150, animationClock->currentTime()); 78 animationClock->unfreeze();
76 EXPECT_EQ(150, animationClock->currentTime()); 79 EXPECT_EQ(200, animationClock->currentTime());
80
81 animationClock->updateTime(300);
82 EXPECT_EQ(300, animationClock->currentTime());
83 mockTime = 400;
84 EXPECT_EQ(300, animationClock->currentTime());
77 } 85 }
78 86
79 } 87 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698