OLD | NEW |
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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 EXPECT_EQ(100, timeline->currentTimeInternal()); | 179 EXPECT_EQ(100, timeline->currentTimeInternal()); |
180 EXPECT_EQ(100, timeline->currentTimeInternal(isNull)); | 180 EXPECT_EQ(100, timeline->currentTimeInternal(isNull)); |
181 EXPECT_FALSE(isNull); | 181 EXPECT_FALSE(isNull); |
182 | 182 |
183 document->animationClock().updateTime(200); | 183 document->animationClock().updateTime(200); |
184 EXPECT_EQ(200, timeline->currentTimeInternal()); | 184 EXPECT_EQ(200, timeline->currentTimeInternal()); |
185 EXPECT_EQ(200, timeline->currentTimeInternal(isNull)); | 185 EXPECT_EQ(200, timeline->currentTimeInternal(isNull)); |
186 EXPECT_FALSE(isNull); | 186 EXPECT_FALSE(isNull); |
187 } | 187 } |
188 | 188 |
| 189 TEST_F(AnimationAnimationTimelineTest, PlaybackRateForInspectorNormal) |
| 190 { |
| 191 timeline = AnimationTimeline::create(document.get()); |
| 192 bool isNull; |
| 193 |
| 194 document->animationClock().updateTime(100); |
| 195 timeline->setPlaybackRate(1.0); |
| 196 EXPECT_EQ(100, timeline->currentTimeInternal()); |
| 197 EXPECT_EQ(100, timeline->currentTimeInternal(isNull)); |
| 198 EXPECT_FALSE(isNull); |
| 199 |
| 200 document->animationClock().updateTime(200); |
| 201 EXPECT_EQ(200, timeline->currentTimeInternal()); |
| 202 EXPECT_EQ(200, timeline->currentTimeInternal(isNull)); |
| 203 EXPECT_FALSE(isNull); |
| 204 } |
| 205 |
| 206 TEST_F(AnimationAnimationTimelineTest, PlaybackRateForInspectorPause) |
| 207 { |
| 208 timeline = AnimationTimeline::create(document.get()); |
| 209 bool isNull; |
| 210 |
| 211 document->animationClock().updateTime(100); |
| 212 EXPECT_EQ(100, timeline->currentTimeInternal()); |
| 213 EXPECT_EQ(100, timeline->currentTimeInternal(isNull)); |
| 214 EXPECT_FALSE(isNull); |
| 215 |
| 216 timeline->setPlaybackRate(0.0); |
| 217 document->animationClock().updateTime(200); |
| 218 EXPECT_EQ(100, timeline->currentTimeInternal()); |
| 219 EXPECT_EQ(100, timeline->currentTimeInternal(isNull)); |
| 220 |
| 221 timeline->setPlaybackRate(1.0); |
| 222 document->animationClock().updateTime(400); |
| 223 EXPECT_EQ(300, timeline->currentTimeInternal()); |
| 224 EXPECT_EQ(300, timeline->currentTimeInternal(isNull)); |
| 225 |
| 226 EXPECT_FALSE(isNull); |
| 227 } |
| 228 |
| 229 TEST_F(AnimationAnimationTimelineTest, PlaybackRateForInspectorSlow) |
| 230 { |
| 231 timeline = AnimationTimeline::create(document.get()); |
| 232 bool isNull; |
| 233 |
| 234 document->animationClock().updateTime(100); |
| 235 EXPECT_EQ(100, timeline->currentTimeInternal()); |
| 236 EXPECT_EQ(100, timeline->currentTimeInternal(isNull)); |
| 237 EXPECT_FALSE(isNull); |
| 238 |
| 239 timeline->setPlaybackRate(0.5); |
| 240 document->animationClock().updateTime(300); |
| 241 EXPECT_EQ(200, timeline->currentTimeInternal()); |
| 242 EXPECT_EQ(200, timeline->currentTimeInternal(isNull)); |
| 243 |
| 244 timeline->setPlaybackRate(1.0); |
| 245 document->animationClock().updateTime(400); |
| 246 EXPECT_EQ(300, timeline->currentTimeInternal()); |
| 247 EXPECT_EQ(300, timeline->currentTimeInternal(isNull)); |
| 248 |
| 249 EXPECT_FALSE(isNull); |
| 250 } |
| 251 |
| 252 TEST_F(AnimationAnimationTimelineTest, PlaybackRateForInspectorFast) |
| 253 { |
| 254 timeline = AnimationTimeline::create(document.get()); |
| 255 bool isNull; |
| 256 |
| 257 document->animationClock().updateTime(100); |
| 258 EXPECT_EQ(100, timeline->currentTimeInternal()); |
| 259 EXPECT_EQ(100, timeline->currentTimeInternal(isNull)); |
| 260 EXPECT_FALSE(isNull); |
| 261 |
| 262 timeline->setPlaybackRate(2); |
| 263 document->animationClock().updateTime(300); |
| 264 EXPECT_EQ(500, timeline->currentTimeInternal()); |
| 265 EXPECT_EQ(500, timeline->currentTimeInternal(isNull)); |
| 266 |
| 267 timeline->setPlaybackRate(1.0); |
| 268 document->animationClock().updateTime(400); |
| 269 EXPECT_EQ(600, timeline->currentTimeInternal()); |
| 270 EXPECT_EQ(600, timeline->currentTimeInternal(isNull)); |
| 271 |
| 272 EXPECT_FALSE(isNull); |
| 273 } |
| 274 |
189 TEST_F(AnimationAnimationTimelineTest, PauseForTesting) | 275 TEST_F(AnimationAnimationTimelineTest, PauseForTesting) |
190 { | 276 { |
191 float seekTime = 1; | 277 float seekTime = 1; |
192 timing.fillMode = Timing::FillModeForwards; | 278 timing.fillMode = Timing::FillModeForwards; |
193 RefPtrWillBeRawPtr<Animation> anim1 = Animation::create(element.get(), Anima
tableValueKeyframeEffectModel::create(AnimatableValueKeyframeVector()), timing); | 279 RefPtrWillBeRawPtr<Animation> anim1 = Animation::create(element.get(), Anima
tableValueKeyframeEffectModel::create(AnimatableValueKeyframeVector()), timing); |
194 RefPtrWillBeRawPtr<Animation> anim2 = Animation::create(element.get(), Anim
atableValueKeyframeEffectModel::create(AnimatableValueKeyframeVector()), timing)
; | 280 RefPtrWillBeRawPtr<Animation> anim2 = Animation::create(element.get(), Anim
atableValueKeyframeEffectModel::create(AnimatableValueKeyframeVector()), timing)
; |
195 AnimationPlayer* player1 = timeline->play(anim1.get()); | 281 AnimationPlayer* player1 = timeline->play(anim1.get()); |
196 AnimationPlayer* player2 = timeline->play(anim2.get()); | 282 AnimationPlayer* player2 = timeline->play(anim2.get()); |
197 timeline->pauseAnimationsForTesting(seekTime); | 283 timeline->pauseAnimationsForTesting(seekTime); |
198 | 284 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 | 325 |
240 TEST_F(AnimationAnimationTimelineTest, UseAnimationPlayerAfterTimelineDeref) | 326 TEST_F(AnimationAnimationTimelineTest, UseAnimationPlayerAfterTimelineDeref) |
241 { | 327 { |
242 RefPtrWillBeRawPtr<AnimationPlayer> player = timeline->createAnimationPlayer
(0); | 328 RefPtrWillBeRawPtr<AnimationPlayer> player = timeline->createAnimationPlayer
(0); |
243 timeline.clear(); | 329 timeline.clear(); |
244 // Test passes if this does not crash. | 330 // Test passes if this does not crash. |
245 player->setStartTime(0); | 331 player->setStartTime(0); |
246 } | 332 } |
247 | 333 |
248 } | 334 } |
OLD | NEW |