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

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

Issue 215043007: Web Animations: Expose timeline currentTime in IDL (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: isNull not isNullTime Created 6 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 unified diff | Download patch
« no previous file with comments | « Source/core/animation/DocumentTimeline.cpp ('k') | Source/core/animation/Timeline.idl » ('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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 EXPECT_TRUE(anim->activeInterpolations().isEmpty()); 162 EXPECT_TRUE(anim->activeInterpolations().isEmpty());
163 163
164 platformTiming->expectNoMoreActions(); 164 platformTiming->expectNoMoreActions();
165 updateClockAndService(100); 165 updateClockAndService(100);
166 EXPECT_FLOAT_EQ(100, timeline->currentTime()); 166 EXPECT_FLOAT_EQ(100, timeline->currentTime());
167 } 167 }
168 168
169 TEST_F(AnimationDocumentTimelineTest, ZeroTime) 169 TEST_F(AnimationDocumentTimelineTest, ZeroTime)
170 { 170 {
171 timeline = DocumentTimeline::create(document.get()); 171 timeline = DocumentTimeline::create(document.get());
172 bool isNull;
172 173
173 document->animationClock().updateTime(100); 174 document->animationClock().updateTime(100);
174 EXPECT_TRUE(isNull(timeline->currentTime())); 175 EXPECT_TRUE(std::isnan(timeline->currentTime()));
176 EXPECT_TRUE(std::isnan(timeline->currentTime(isNull)));
177 EXPECT_TRUE(isNull);
175 178
176 document->animationClock().updateTime(200); 179 document->animationClock().updateTime(200);
177 EXPECT_TRUE(isNull(timeline->currentTime())); 180 EXPECT_TRUE(std::isnan(timeline->currentTime()));
178 181
179 timeline->setZeroTime(300); 182 timeline->setZeroTime(300);
180 document->animationClock().updateTime(300); 183 document->animationClock().updateTime(300);
181 EXPECT_EQ(0, timeline->currentTime()); 184 EXPECT_EQ(0, timeline->currentTime());
185 EXPECT_EQ(0, timeline->currentTime(isNull));
186 EXPECT_FALSE(isNull);
182 187
183 document->animationClock().updateTime(400); 188 document->animationClock().updateTime(400);
184 EXPECT_EQ(100, timeline->currentTime()); 189 EXPECT_EQ(100, timeline->currentTime());
185 } 190 }
186 191
187 TEST_F(AnimationDocumentTimelineTest, PauseForTesting) 192 TEST_F(AnimationDocumentTimelineTest, PauseForTesting)
188 { 193 {
189 float seekTime = 1; 194 float seekTime = 1;
190 timing.fillMode = Timing::FillModeForwards; 195 timing.fillMode = Timing::FillModeForwards;
191 RefPtr<Animation> anim1 = Animation::create(element.get(), KeyframeEffectMod el::create(KeyframeEffectModel::KeyframeVector()), timing); 196 RefPtr<Animation> anim1 = Animation::create(element.get(), KeyframeEffectMod el::create(KeyframeEffectModel::KeyframeVector()), timing);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 291
287 TEST_F(AnimationDocumentTimelineTest, UseAnimationPlayerAfterTimelineDeref) 292 TEST_F(AnimationDocumentTimelineTest, UseAnimationPlayerAfterTimelineDeref)
288 { 293 {
289 RefPtr<AnimationPlayer> player = timeline->createAnimationPlayer(0); 294 RefPtr<AnimationPlayer> player = timeline->createAnimationPlayer(0);
290 timeline.clear(); 295 timeline.clear();
291 // Test passes if this does not crash. 296 // Test passes if this does not crash.
292 player->setStartTime(0); 297 player->setStartTime(0);
293 } 298 }
294 299
295 } 300 }
OLDNEW
« no previous file with comments | « Source/core/animation/DocumentTimeline.cpp ('k') | Source/core/animation/Timeline.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698