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

Side by Side Diff: sky/engine/core/animation/AnimationTimelineTest.cpp

Issue 1020053002: Remove pauseAnimationsForTesting (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « sky/engine/core/animation/AnimationTimeline.cpp ('k') | sky/engine/core/page/PageAnimator.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 EXPECT_EQ(100, timeline->currentTimeInternal()); 171 EXPECT_EQ(100, timeline->currentTimeInternal());
172 EXPECT_EQ(100, timeline->currentTimeInternal(isNull)); 172 EXPECT_EQ(100, timeline->currentTimeInternal(isNull));
173 EXPECT_FALSE(isNull); 173 EXPECT_FALSE(isNull);
174 174
175 document->animationClock().updateTime(200); 175 document->animationClock().updateTime(200);
176 EXPECT_EQ(200, timeline->currentTimeInternal()); 176 EXPECT_EQ(200, timeline->currentTimeInternal());
177 EXPECT_EQ(200, timeline->currentTimeInternal(isNull)); 177 EXPECT_EQ(200, timeline->currentTimeInternal(isNull));
178 EXPECT_FALSE(isNull); 178 EXPECT_FALSE(isNull);
179 } 179 }
180 180
181 TEST_F(AnimationAnimationTimelineTest, PauseForTesting)
182 {
183 float seekTime = 1;
184 timing.fillMode = Timing::FillModeForwards;
185 RefPtr<Animation> anim1 = Animation::create(element.get(), AnimatableValueKe yframeEffectModel::create(AnimatableValueKeyframeVector()), timing);
186 RefPtr<Animation> anim2 = Animation::create(element.get(), AnimatableValueK eyframeEffectModel::create(AnimatableValueKeyframeVector()), timing);
187 AnimationPlayer* player1 = timeline->play(anim1.get());
188 AnimationPlayer* player2 = timeline->play(anim2.get());
189 timeline->pauseAnimationsForTesting(seekTime);
190
191 EXPECT_FLOAT_EQ(seekTime, player1->currentTimeInternal());
192 EXPECT_FLOAT_EQ(seekTime, player2->currentTimeInternal());
193 }
194
195 TEST_F(AnimationAnimationTimelineTest, DelayBeforeAnimationStart) 181 TEST_F(AnimationAnimationTimelineTest, DelayBeforeAnimationStart)
196 { 182 {
197 timing.iterationDuration = 2; 183 timing.iterationDuration = 2;
198 timing.startDelay = 5; 184 timing.startDelay = 5;
199 185
200 RefPtr<Animation> anim = Animation::create(element.get(), nullptr, timing); 186 RefPtr<Animation> anim = Animation::create(element.get(), nullptr, timing);
201 187
202 timeline->play(anim.get()); 188 timeline->play(anim.get());
203 189
204 // TODO: Put the player startTime in the future when we add the capability t o change player startTime 190 // TODO: Put the player startTime in the future when we add the capability t o change player startTime
(...skipping 26 matching lines...) Expand all
231 217
232 TEST_F(AnimationAnimationTimelineTest, UseAnimationPlayerAfterTimelineDeref) 218 TEST_F(AnimationAnimationTimelineTest, UseAnimationPlayerAfterTimelineDeref)
233 { 219 {
234 RefPtr<AnimationPlayer> player = timeline->createAnimationPlayer(0); 220 RefPtr<AnimationPlayer> player = timeline->createAnimationPlayer(0);
235 timeline.clear(); 221 timeline.clear();
236 // Test passes if this does not crash. 222 // Test passes if this does not crash.
237 player->setStartTime(0); 223 player->setStartTime(0);
238 } 224 }
239 225
240 } 226 }
OLDNEW
« no previous file with comments | « sky/engine/core/animation/AnimationTimeline.cpp ('k') | sky/engine/core/page/PageAnimator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698