From bb27cadfda0f2bc6f743f811ac87526178cea9b4 Mon Sep 17 00:00:00 2001 From: Suzy Howlett Date: Thu, 14 Jul 2016 14:46:06 +1000 Subject: [PATCH 1/9] Upstream negative-playback-rate.html, positive-playback-rate.html from Blink Import https://chromium.googlesource.com/chromium/src/+/fe9ded7a6424a3808af6c51d5b839c4f0e7cb280/third_party/WebKit/LayoutTests/web-animations-api/animation-state-changes-negative-playback-rate.html https://chromium.googlesource.com/chromium/src/+/3eda0025374cfc23d3e9af70f945f1a7b3ac6fee/third_party/WebKit/LayoutTests/web-animations-api/playState-changes.html --- .../play-state/negative-playback-rate.html | 358 ++++++++++++++++ .../play-state/positive-playback-rate.html | 384 ++++++++++++++++++ 2 files changed, 742 insertions(+) create mode 100644 web-animations/animation-model/play-state/negative-playback-rate.html create mode 100644 web-animations/animation-model/play-state/positive-playback-rate.html diff --git a/web-animations/animation-model/play-state/negative-playback-rate.html b/web-animations/animation-model/play-state/negative-playback-rate.html new file mode 100644 index 00000000000000..c6c11e25cdd83b --- /dev/null +++ b/web-animations/animation-model/play-state/negative-playback-rate.html @@ -0,0 +1,358 @@ + + +Test play state changes for animations with a negative playback rate + + + + + + diff --git a/web-animations/animation-model/play-state/positive-playback-rate.html b/web-animations/animation-model/play-state/positive-playback-rate.html new file mode 100644 index 00000000000000..37754f2b48d000 --- /dev/null +++ b/web-animations/animation-model/play-state/positive-playback-rate.html @@ -0,0 +1,384 @@ + + +Tests for discrete animation + + + + + + From 65eb49641e30d38efcf430d21cabcf316ee9d2dd Mon Sep 17 00:00:00 2001 From: Suzy Howlett Date: Thu, 14 Jul 2016 15:39:23 +1000 Subject: [PATCH 2/9] Clean up opening of files - Script import order - Page title - Body tags - 'use strict' --- .../animation-model/play-state/negative-playback-rate.html | 7 +++++-- .../animation-model/play-state/positive-playback-rate.html | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/web-animations/animation-model/play-state/negative-playback-rate.html b/web-animations/animation-model/play-state/negative-playback-rate.html index c6c11e25cdd83b..baa9e36bf911bd 100644 --- a/web-animations/animation-model/play-state/negative-playback-rate.html +++ b/web-animations/animation-model/play-state/negative-playback-rate.html @@ -2,11 +2,13 @@ Test play state changes for animations with a negative playback rate - - + + + diff --git a/web-animations/animation-model/play-state/positive-playback-rate.html b/web-animations/animation-model/play-state/positive-playback-rate.html index 37754f2b48d000..575636c08fd3a0 100644 --- a/web-animations/animation-model/play-state/positive-playback-rate.html +++ b/web-animations/animation-model/play-state/positive-playback-rate.html @@ -1,6 +1,6 @@ -Tests for discrete animation +Test play state changes for animations with a positive playback rate @@ -8,6 +8,7 @@ + From 67c3afc00ab76076afdda94b1263bf5ccba225b7 Mon Sep 17 00:00:00 2001 From: Suzy Howlett Date: Thu, 14 Jul 2016 15:41:36 +1000 Subject: [PATCH 3/9] Remove non-standard assert_unresolved helper --- .../play-state/negative-playback-rate.html | 66 +++++++++---------- 1 file changed, 31 insertions(+), 35 deletions(-) diff --git a/web-animations/animation-model/play-state/negative-playback-rate.html b/web-animations/animation-model/play-state/negative-playback-rate.html index baa9e36bf911bd..1f8694a51cc621 100644 --- a/web-animations/animation-model/play-state/negative-playback-rate.html +++ b/web-animations/animation-model/play-state/negative-playback-rate.html @@ -11,10 +11,6 @@ var duration = 100000; -function assert_unresolved(value) { - assert_equals(value, null); -} - function idleAnimation() { var animation = document.documentElement.animate([], duration); animation.reverse(); @@ -51,14 +47,14 @@ test(function() { var animation = idleAnimation(); - assert_unresolved(animation.startTime); - assert_unresolved(animation.currentTime); + assert_equals(animation.startTime, null); + assert_equals(animation.currentTime, null); assert_equals(animation.playState, 'idle'); }, "Play state is idle after cancelling a reversed animation"); test(function() { var animation = pendingAnimation(); - assert_unresolved(animation.startTime); + assert_equals(animation.startTime, null); assert_equals(animation.currentTime, duration); assert_equals(animation.playState, 'pending'); }, "Play state is pending after playing a cancelled reversed animation"); @@ -72,7 +68,7 @@ test(function() { var animation = pausedAnimation(); - assert_unresolved(animation.startTime); + assert_equals(animation.startTime, null); assert_equals(animation.currentTime, duration); assert_equals(animation.playState, 'paused'); }, "Play state is paused after pausing and setting current time of a cancelled reversed animation"); @@ -87,7 +83,7 @@ test(function() { var animation = idleAnimation(); animation.play(); - assert_unresolved(animation.startTime); + assert_equals(animation.startTime, null); assert_equals(animation.currentTime, duration); assert_equals(animation.playState, 'pending'); }, "Calling play() on an idle animation"); @@ -95,7 +91,7 @@ test(function() { var animation = idleAnimation(); animation.pause(); - assert_unresolved(animation.startTime); + assert_equals(animation.startTime, null); assert_equals(animation.currentTime, duration); assert_equals(animation.playState, 'pending'); }, "Calling pause() on an idle animation"); @@ -103,8 +99,8 @@ test(function() { var animation = idleAnimation(); animation.cancel(); - assert_unresolved(animation.startTime); - assert_unresolved(animation.currentTime); + assert_equals(animation.startTime, null); + assert_equals(animation.currentTime, null); assert_equals(animation.playState, 'idle'); }, "Calling cancel() on an idle animation"); @@ -119,7 +115,7 @@ test(function() { var animation = idleAnimation(); animation.reverse(); - assert_unresolved(animation.startTime); + assert_equals(animation.startTime, null); assert_equals(animation.currentTime, 0); assert_equals(animation.playState, 'pending'); }, "Calling reverse() on an idle animation"); @@ -127,7 +123,7 @@ test(function() { var animation = idleAnimation(); animation.currentTime = 1000; - assert_unresolved(animation.startTime); + assert_equals(animation.startTime, null); assert_equals(animation.currentTime, 1000); assert_equals(animation.playState, 'paused'); }, "Setting currentTime on an idle animation"); @@ -143,7 +139,7 @@ test(function() { var animation = pendingAnimation(); animation.play(); - assert_unresolved(animation.startTime); + assert_equals(animation.startTime, null); assert_equals(animation.currentTime, duration); assert_equals(animation.playState, 'pending'); }, "Calling play() on a pending animation"); @@ -151,7 +147,7 @@ test(function() { var animation = pendingAnimation(); animation.pause(); - assert_unresolved(animation.startTime); + assert_equals(animation.startTime, null); assert_equals(animation.currentTime, duration); assert_equals(animation.playState, 'pending'); }, "Calling pause() on a pending animation"); @@ -159,8 +155,8 @@ test(function() { var animation = pendingAnimation(); animation.cancel(); - assert_unresolved(animation.startTime); - assert_unresolved(animation.currentTime); + assert_equals(animation.startTime, null); + assert_equals(animation.currentTime, null); assert_equals(animation.playState, 'idle'); }, "Calling cancel() on a pending animation"); @@ -175,7 +171,7 @@ test(function() { var animation = pendingAnimation(); animation.reverse(); - assert_unresolved(animation.startTime); + assert_equals(animation.startTime, null); assert_equals(animation.currentTime, 0); assert_equals(animation.playState, 'pending'); }, "Calling reverse() on a pending animation"); @@ -183,7 +179,7 @@ test(function() { var animation = pendingAnimation(); animation.currentTime = 1000; - assert_unresolved(animation.startTime); + assert_equals(animation.startTime, null); assert_equals(animation.currentTime, 1000); assert_equals(animation.playState, 'pending'); }, "Setting currentTime on a pending animation"); @@ -209,7 +205,7 @@ test(function() { var animation = runningAnimation(); animation.pause(); - assert_unresolved(animation.startTime); + assert_equals(animation.startTime, null); assert_times_equal(animation.currentTime, duration / 2); assert_equals(animation.playState, 'pending'); }, "Calling pause() on a running animation"); @@ -217,8 +213,8 @@ test(function() { var animation = runningAnimation(); animation.cancel(); - assert_unresolved(animation.startTime); - assert_unresolved(animation.currentTime); + assert_equals(animation.startTime, null); + assert_equals(animation.currentTime, null); assert_equals(animation.playState, 'idle'); }, "Calling cancel() on a running animation"); @@ -233,7 +229,7 @@ test(function() { var animation = runningAnimation(); animation.reverse(); - assert_unresolved(animation.startTime); + assert_equals(animation.startTime, null); assert_times_equal(animation.currentTime, duration / 2); assert_equals(animation.playState, 'pending'); }, "Calling reverse() on a running animation"); @@ -257,7 +253,7 @@ test(function() { var animation = pausedAnimation(); animation.play(); - assert_unresolved(animation.startTime); + assert_equals(animation.startTime, null); assert_equals(animation.currentTime, duration); assert_equals(animation.playState, 'pending'); }, "Calling play() on a paused animation"); @@ -265,7 +261,7 @@ test(function() { var animation = pausedAnimation(); animation.pause(); - assert_unresolved(animation.startTime); + assert_equals(animation.startTime, null); assert_equals(animation.currentTime, duration); assert_equals(animation.playState, 'paused'); }, "Calling pause() on a paused animation"); @@ -273,8 +269,8 @@ test(function() { var animation = pausedAnimation(); animation.cancel(); - assert_unresolved(animation.startTime); - assert_unresolved(animation.currentTime); + assert_equals(animation.startTime, null); + assert_equals(animation.currentTime, null); assert_equals(animation.playState, 'idle'); }, "Calling cancel() on a paused animation"); @@ -289,7 +285,7 @@ test(function() { var animation = pausedAnimation(); animation.reverse(); - assert_unresolved(animation.startTime); + assert_equals(animation.startTime, null); assert_equals(animation.currentTime, 0); assert_equals(animation.playState, 'pending'); }, "Calling reverse() on a paused animation"); @@ -297,7 +293,7 @@ test(function() { var animation = pausedAnimation(); animation.currentTime = 1000; - assert_unresolved(animation.startTime); + assert_equals(animation.startTime, null); assert_equals(animation.currentTime, 1000); assert_equals(animation.playState, 'paused'); }, "Setting currentTime on a paused animation"); @@ -313,7 +309,7 @@ test(function() { var animation = finishedAnimation(); animation.play(); - assert_unresolved(animation.startTime); + assert_equals(animation.startTime, null); assert_equals(animation.currentTime, duration); assert_equals(animation.playState, 'pending'); }, "Calling play() on a finished animation"); @@ -321,7 +317,7 @@ test(function() { var animation = finishedAnimation(); animation.pause(); - assert_unresolved(animation.startTime); + assert_equals(animation.startTime, null); assert_equals(animation.currentTime, 0); assert_equals(animation.playState, 'pending'); }, "Calling pause() on a finished animation"); @@ -329,8 +325,8 @@ test(function() { var animation = finishedAnimation(); animation.cancel(); - assert_unresolved(animation.startTime); - assert_unresolved(animation.currentTime); + assert_equals(animation.startTime, null); + assert_equals(animation.currentTime, null); assert_equals(animation.playState, 'idle'); }, "Calling cancel() on a finished animation"); @@ -345,7 +341,7 @@ test(function() { var animation = finishedAnimation(); animation.reverse(); - assert_unresolved(animation.startTime); + assert_equals(animation.startTime, null); assert_equals(animation.currentTime, 0); assert_equals(animation.playState, 'pending'); }, "Calling reverse() on a finished animation"); From 2c49f875d2fce1000ee124a8b73142436017a169 Mon Sep 17 00:00:00 2001 From: Suzy Howlett Date: Thu, 14 Jul 2016 15:45:46 +1000 Subject: [PATCH 4/9] Expand time literals with MS_PER_SEC - Use "* MS_PER_SEC" instead of millisecond values - Do not use global variable --- .../play-state/negative-playback-rate.html | 76 +++++++++---------- .../play-state/positive-playback-rate.html | 70 ++++++++--------- 2 files changed, 72 insertions(+), 74 deletions(-) diff --git a/web-animations/animation-model/play-state/negative-playback-rate.html b/web-animations/animation-model/play-state/negative-playback-rate.html index 1f8694a51cc621..793a02bf2314ed 100644 --- a/web-animations/animation-model/play-state/negative-playback-rate.html +++ b/web-animations/animation-model/play-state/negative-playback-rate.html @@ -9,10 +9,8 @@ diff --git a/web-animations/animation-model/play-state/positive-playback-rate.html b/web-animations/animation-model/play-state/positive-playback-rate.html index 575636c08fd3a0..22f426fba65899 100644 --- a/web-animations/animation-model/play-state/positive-playback-rate.html +++ b/web-animations/animation-model/play-state/positive-playback-rate.html @@ -10,7 +10,7 @@ 'use strict'; function createIdleAnimation(t) { - var animation = createDiv(t).animate([], 100000); + var animation = createDiv(t).animate([], 100 * MS_PER_SEC); animation.cancel(); return animation; } @@ -74,7 +74,7 @@ test(function(t) { var animation = createFinishedAnimation(t); assert_equals(animation.startTime, document.timeline.currentTime - animation.currentTime); - assert_equals(animation.currentTime, 100000); + assert_equals(animation.currentTime, 100 * MS_PER_SEC); assert_equals(animation.playState, 'finished'); }, "Play state is finished after playing and finishing a cancelled animation"); @@ -107,7 +107,7 @@ var animation = createIdleAnimation(t); animation.finish(); assert_equals(animation.startTime, document.timeline.currentTime - animation.currentTime); - assert_equals(animation.currentTime, 100000); + assert_equals(animation.currentTime, 100 * MS_PER_SEC); assert_equals(animation.playState, 'finished'); }, "Calling finish() on an idle animation"); @@ -115,23 +115,23 @@ var animation = createIdleAnimation(t); animation.reverse(); assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 100000); + assert_equals(animation.currentTime, 100 * MS_PER_SEC); assert_equals(animation.playState, 'pending'); }, "Calling reverse() on an idle animation"); test(function(t) { var animation = createIdleAnimation(t); - animation.currentTime = 1000; + animation.currentTime = 1 * MS_PER_SEC; assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 1000); + assert_equals(animation.currentTime, 1 * MS_PER_SEC); assert_equals(animation.playState, 'paused'); }, "Setting currentTime on an idle animation"); test(function(t) { var animation = createIdleAnimation(t); - animation.startTime = document.timeline.currentTime - 1000; - assert_equals(animation.startTime, document.timeline.currentTime - 1000); - assert_equals(animation.currentTime, 1000); + animation.startTime = document.timeline.currentTime - 1 * MS_PER_SEC; + assert_equals(animation.startTime, document.timeline.currentTime - 1 * MS_PER_SEC); + assert_equals(animation.currentTime, 1 * MS_PER_SEC); assert_equals(animation.playState, 'running'); }, "Setting startTime on an idle animation"); @@ -163,7 +163,7 @@ var animation = createPendingStartTimeAnimation(t); animation.finish(); assert_equals(animation.startTime, document.timeline.currentTime - animation.currentTime); - assert_equals(animation.currentTime, 100000); + assert_equals(animation.currentTime, 100 * MS_PER_SEC); assert_equals(animation.playState, 'finished'); }, "Calling finish() on a pending starttime animation"); @@ -171,23 +171,23 @@ var animation = createPendingStartTimeAnimation(t); animation.reverse(); assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 100000); + assert_equals(animation.currentTime, 100 * MS_PER_SEC); assert_equals(animation.playState, 'pending'); }, "Calling reverse() on a pending starttime animation"); test(function(t) { var animation = createPendingStartTimeAnimation(t); - animation.currentTime = 1000; + animation.currentTime = 1 * MS_PER_SEC; assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 1000); + assert_equals(animation.currentTime, 1 * MS_PER_SEC); assert_equals(animation.playState, 'pending'); }, "Setting currentTime on a pending starttime animation"); test(function(t) { var animation = createPendingStartTimeAnimation(t); - animation.startTime = document.timeline.currentTime - 1000; - assert_equals(animation.startTime, document.timeline.currentTime - 1000); - assert_equals(animation.currentTime, 1000); + animation.startTime = document.timeline.currentTime - 1 * MS_PER_SEC; + assert_equals(animation.startTime, document.timeline.currentTime - 1 * MS_PER_SEC); + assert_equals(animation.currentTime, 1 * MS_PER_SEC); assert_equals(animation.playState, 'running'); }, "Setting startTime on a pending starttime animation"); @@ -221,7 +221,7 @@ var animation = createRunningAnimation(t); animation.finish(); assert_equals(animation.startTime, document.timeline.currentTime - animation.currentTime); - assert_equals(animation.currentTime, 100000); + assert_equals(animation.currentTime, 100 * MS_PER_SEC); assert_equals(animation.playState, 'finished'); }, "Setting finish() on a running animation"); @@ -229,24 +229,24 @@ var animation = createRunningAnimation(t); animation.reverse(); assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 100000); + assert_equals(animation.currentTime, 100 * MS_PER_SEC); assert_equals(animation.playState, 'pending'); }, "Setting reverse() on a running animation"); test(function(t) { var animation = createRunningAnimation(t); - animation.currentTime = 1000; + animation.currentTime = 1 * MS_PER_SEC; assert_equals(animation.startTime, document.timeline.currentTime - animation.currentTime); - assert_equals(animation.currentTime, 1000); + assert_equals(animation.currentTime, 1 * MS_PER_SEC); assert_equals(animation.playState, 'running'); }, "Setting currentTime on a running animation"); test(function(t) { var animation = createRunningAnimation(t); - animation.startTime = document.timeline.currentTime - 1000; - assert_equals(animation.startTime, document.timeline.currentTime - 1000); - assert_equals(animation.currentTime, 1000); + animation.startTime = document.timeline.currentTime - 1 * MS_PER_SEC; + assert_equals(animation.startTime, document.timeline.currentTime - 1 * MS_PER_SEC); + assert_equals(animation.currentTime, 1 * MS_PER_SEC); assert_equals(animation.playState, 'running'); }, "Setting startTime on a running animation"); @@ -278,7 +278,7 @@ var animation = createPausedAnimation(t); animation.finish(); assert_equals(animation.startTime, document.timeline.currentTime - animation.currentTime); - assert_equals(animation.currentTime, 100000); + assert_equals(animation.currentTime, 100 * MS_PER_SEC); assert_equals(animation.playState, 'finished'); }, "Calling finish() on a paused animation"); @@ -286,23 +286,23 @@ var animation = createPausedAnimation(t); animation.reverse(); assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 100000); + assert_equals(animation.currentTime, 100 * MS_PER_SEC); assert_equals(animation.playState, 'pending'); }, "Calling reverse() on a paused animation"); test(function(t) { var animation = createPausedAnimation(t); - animation.currentTime = 1000; + animation.currentTime = 1 * MS_PER_SEC; assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 1000); + assert_equals(animation.currentTime, 1 * MS_PER_SEC); assert_equals(animation.playState, 'paused'); }, "Setting currentTime on a paused animation"); test(function(t) { var animation = createPausedAnimation(t); - animation.startTime = document.timeline.currentTime - 1000; - assert_equals(animation.startTime, document.timeline.currentTime - 1000); - assert_equals(animation.currentTime, 1000); + animation.startTime = document.timeline.currentTime - 1 * MS_PER_SEC; + assert_equals(animation.startTime, document.timeline.currentTime - 1 * MS_PER_SEC); + assert_equals(animation.currentTime, 1 * MS_PER_SEC); assert_equals(animation.playState, 'running'); }, "Setting startTime on a paused animation"); @@ -318,7 +318,7 @@ var animation = createFinishedAnimation(t); animation.pause(); assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 100000); + assert_equals(animation.currentTime, 100 * MS_PER_SEC); assert_equals(animation.playState, 'pending'); }, "Calling pause() on a finished animation"); @@ -334,7 +334,7 @@ var animation = createFinishedAnimation(t); animation.finish(); assert_equals(animation.startTime, document.timeline.currentTime - animation.currentTime); - assert_equals(animation.currentTime, 100000); + assert_equals(animation.currentTime, 100 * MS_PER_SEC); assert_equals(animation.playState, 'finished'); }, "Calling finish() on a finished animation"); @@ -342,15 +342,15 @@ var animation = createFinishedAnimation(t); animation.reverse(); assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 100000); + assert_equals(animation.currentTime, 100 * MS_PER_SEC); assert_equals(animation.playState, 'pending'); }, "Calling reverse() on a finished animation"); test(function(t) { var animation = createFinishedAnimation(t); - animation.currentTime = 1000; + animation.currentTime = 1 * MS_PER_SEC; assert_equals(animation.startTime, document.timeline.currentTime - animation.currentTime); - assert_equals(animation.currentTime, 1000); + assert_equals(animation.currentTime, 1 * MS_PER_SEC); assert_equals(animation.playState, 'running'); }, "Setting currentTime on a finished animation"); From a7d44fff55056eda7ff4f58cc8132c23983ea89e Mon Sep 17 00:00:00 2001 From: Suzy Howlett Date: Thu, 14 Jul 2016 15:50:31 +1000 Subject: [PATCH 5/9] Make *-playback-rate.html helpers consistent Convert the helper functions in negative-playback-rate.html (that create animations in various states) to the same format and naming styl as used by positive-playback-rate.html. --- .../play-state/negative-playback-rate.html | 176 +++++++++--------- 1 file changed, 88 insertions(+), 88 deletions(-) diff --git a/web-animations/animation-model/play-state/negative-playback-rate.html b/web-animations/animation-model/play-state/negative-playback-rate.html index 793a02bf2314ed..42cf1311624263 100644 --- a/web-animations/animation-model/play-state/negative-playback-rate.html +++ b/web-animations/animation-model/play-state/negative-playback-rate.html @@ -9,189 +9,189 @@ diff --git a/web-animations/animation-model/play-state/positive-playback-rate.html b/web-animations/animation-model/play-state/positive-playback-rate.html index 22f426fba65899..9f4d4345b28167 100644 --- a/web-animations/animation-model/play-state/positive-playback-rate.html +++ b/web-animations/animation-model/play-state/positive-playback-rate.html @@ -53,28 +53,28 @@ test(function(t) { var animation = createPendingStartTimeAnimation(t); assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 0); + assert_times_equal(animation.currentTime, 0); assert_equals(animation.playState, 'pending'); }, "Play state is pending after playing a cancelled animation"); test(function(t) { var animation = createRunningAnimation(t); - assert_equals(animation.startTime, document.timeline.currentTime - animation.currentTime); - assert_equals(animation.currentTime, 0); + assert_times_equal(animation.startTime, document.timeline.currentTime - animation.currentTime); + assert_times_equal(animation.currentTime, 0); assert_equals(animation.playState, 'running'); }, "Play state is running after playing and setting start time of a cancelled animation"); test(function(t) { var animation = createPausedAnimation(t); assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 0); + assert_times_equal(animation.currentTime, 0); assert_equals(animation.playState, 'paused'); }, "Play state is paused after pausing and setting current time of a cancelled animation"); test(function(t) { var animation = createFinishedAnimation(t); - assert_equals(animation.startTime, document.timeline.currentTime - animation.currentTime); - assert_equals(animation.currentTime, 100 * MS_PER_SEC); + assert_times_equal(animation.startTime, document.timeline.currentTime - animation.currentTime); + assert_times_equal(animation.currentTime, 100 * MS_PER_SEC); assert_equals(animation.playState, 'finished'); }, "Play state is finished after playing and finishing a cancelled animation"); @@ -83,7 +83,7 @@ var animation = createIdleAnimation(t); animation.play(); assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 0); + assert_times_equal(animation.currentTime, 0); assert_equals(animation.playState, 'pending'); }, "Calling play() on an idle animation"); @@ -91,7 +91,7 @@ var animation = createIdleAnimation(t); animation.pause(); assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 0); + assert_times_equal(animation.currentTime, 0); assert_equals(animation.playState, 'pending'); }, "Calling pause() on an idle animation"); @@ -106,8 +106,8 @@ test(function(t) { var animation = createIdleAnimation(t); animation.finish(); - assert_equals(animation.startTime, document.timeline.currentTime - animation.currentTime); - assert_equals(animation.currentTime, 100 * MS_PER_SEC); + assert_times_equal(animation.startTime, document.timeline.currentTime - animation.currentTime); + assert_times_equal(animation.currentTime, 100 * MS_PER_SEC); assert_equals(animation.playState, 'finished'); }, "Calling finish() on an idle animation"); @@ -115,7 +115,7 @@ var animation = createIdleAnimation(t); animation.reverse(); assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 100 * MS_PER_SEC); + assert_times_equal(animation.currentTime, 100 * MS_PER_SEC); assert_equals(animation.playState, 'pending'); }, "Calling reverse() on an idle animation"); @@ -123,15 +123,15 @@ var animation = createIdleAnimation(t); animation.currentTime = 1 * MS_PER_SEC; assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 1 * MS_PER_SEC); + assert_times_equal(animation.currentTime, 1 * MS_PER_SEC); assert_equals(animation.playState, 'paused'); }, "Setting currentTime on an idle animation"); test(function(t) { var animation = createIdleAnimation(t); animation.startTime = document.timeline.currentTime - 1 * MS_PER_SEC; - assert_equals(animation.startTime, document.timeline.currentTime - 1 * MS_PER_SEC); - assert_equals(animation.currentTime, 1 * MS_PER_SEC); + assert_times_equal(animation.startTime, document.timeline.currentTime - 1 * MS_PER_SEC); + assert_times_equal(animation.currentTime, 1 * MS_PER_SEC); assert_equals(animation.playState, 'running'); }, "Setting startTime on an idle animation"); @@ -139,7 +139,7 @@ var animation = createPendingStartTimeAnimation(t); animation.play(); assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 0); + assert_times_equal(animation.currentTime, 0); assert_equals(animation.playState, 'pending'); }, "Calling play() on a pending starttime animation"); @@ -147,7 +147,7 @@ var animation = createPendingStartTimeAnimation(t); animation.pause(); assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 0); + assert_times_equal(animation.currentTime, 0); assert_equals(animation.playState, 'pending'); }, "Calling pause() on a pending starttime animation"); @@ -162,8 +162,8 @@ test(function(t) { var animation = createPendingStartTimeAnimation(t); animation.finish(); - assert_equals(animation.startTime, document.timeline.currentTime - animation.currentTime); - assert_equals(animation.currentTime, 100 * MS_PER_SEC); + assert_times_equal(animation.startTime, document.timeline.currentTime - animation.currentTime); + assert_times_equal(animation.currentTime, 100 * MS_PER_SEC); assert_equals(animation.playState, 'finished'); }, "Calling finish() on a pending starttime animation"); @@ -171,7 +171,7 @@ var animation = createPendingStartTimeAnimation(t); animation.reverse(); assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 100 * MS_PER_SEC); + assert_times_equal(animation.currentTime, 100 * MS_PER_SEC); assert_equals(animation.playState, 'pending'); }, "Calling reverse() on a pending starttime animation"); @@ -179,15 +179,15 @@ var animation = createPendingStartTimeAnimation(t); animation.currentTime = 1 * MS_PER_SEC; assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 1 * MS_PER_SEC); + assert_times_equal(animation.currentTime, 1 * MS_PER_SEC); assert_equals(animation.playState, 'pending'); }, "Setting currentTime on a pending starttime animation"); test(function(t) { var animation = createPendingStartTimeAnimation(t); animation.startTime = document.timeline.currentTime - 1 * MS_PER_SEC; - assert_equals(animation.startTime, document.timeline.currentTime - 1 * MS_PER_SEC); - assert_equals(animation.currentTime, 1 * MS_PER_SEC); + assert_times_equal(animation.startTime, document.timeline.currentTime - 1 * MS_PER_SEC); + assert_times_equal(animation.currentTime, 1 * MS_PER_SEC); assert_equals(animation.playState, 'running'); }, "Setting startTime on a pending starttime animation"); @@ -196,8 +196,8 @@ var startTime = animation.startTime; var currentTime = animation.currentTime; animation.play(); - assert_equals(animation.startTime, startTime); - assert_equals(animation.currentTime, currentTime); + assert_times_equal(animation.startTime, startTime); + assert_times_equal(animation.currentTime, currentTime); assert_equals(animation.playState, 'running'); }, "Setting play() on a running animation"); @@ -205,7 +205,7 @@ var animation = createRunningAnimation(t); animation.pause(); assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 0); + assert_times_equal(animation.currentTime, 0); assert_equals(animation.playState, 'pending'); }, "Setting pause() on a running animation"); @@ -220,8 +220,8 @@ test(function(t) { var animation = createRunningAnimation(t); animation.finish(); - assert_equals(animation.startTime, document.timeline.currentTime - animation.currentTime); - assert_equals(animation.currentTime, 100 * MS_PER_SEC); + assert_times_equal(animation.startTime, document.timeline.currentTime - animation.currentTime); + assert_times_equal(animation.currentTime, 100 * MS_PER_SEC); assert_equals(animation.playState, 'finished'); }, "Setting finish() on a running animation"); @@ -229,7 +229,7 @@ var animation = createRunningAnimation(t); animation.reverse(); assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 100 * MS_PER_SEC); + assert_times_equal(animation.currentTime, 100 * MS_PER_SEC); assert_equals(animation.playState, 'pending'); }, "Setting reverse() on a running animation"); @@ -237,16 +237,16 @@ test(function(t) { var animation = createRunningAnimation(t); animation.currentTime = 1 * MS_PER_SEC; - assert_equals(animation.startTime, document.timeline.currentTime - animation.currentTime); - assert_equals(animation.currentTime, 1 * MS_PER_SEC); + assert_times_equal(animation.startTime, document.timeline.currentTime - animation.currentTime); + assert_times_equal(animation.currentTime, 1 * MS_PER_SEC); assert_equals(animation.playState, 'running'); }, "Setting currentTime on a running animation"); test(function(t) { var animation = createRunningAnimation(t); animation.startTime = document.timeline.currentTime - 1 * MS_PER_SEC; - assert_equals(animation.startTime, document.timeline.currentTime - 1 * MS_PER_SEC); - assert_equals(animation.currentTime, 1 * MS_PER_SEC); + assert_times_equal(animation.startTime, document.timeline.currentTime - 1 * MS_PER_SEC); + assert_times_equal(animation.currentTime, 1 * MS_PER_SEC); assert_equals(animation.playState, 'running'); }, "Setting startTime on a running animation"); @@ -254,7 +254,7 @@ var animation = createPausedAnimation(t); animation.play(); assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 0); + assert_times_equal(animation.currentTime, 0); assert_equals(animation.playState, 'pending'); }, "Calling play() on a paused animation"); @@ -262,7 +262,7 @@ var animation = createPausedAnimation(t); animation.pause(); assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 0); + assert_times_equal(animation.currentTime, 0); assert_equals(animation.playState, 'paused'); }, "Calling pause() on a paused animation"); @@ -277,8 +277,8 @@ test(function(t) { var animation = createPausedAnimation(t); animation.finish(); - assert_equals(animation.startTime, document.timeline.currentTime - animation.currentTime); - assert_equals(animation.currentTime, 100 * MS_PER_SEC); + assert_times_equal(animation.startTime, document.timeline.currentTime - animation.currentTime); + assert_times_equal(animation.currentTime, 100 * MS_PER_SEC); assert_equals(animation.playState, 'finished'); }, "Calling finish() on a paused animation"); @@ -286,7 +286,7 @@ var animation = createPausedAnimation(t); animation.reverse(); assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 100 * MS_PER_SEC); + assert_times_equal(animation.currentTime, 100 * MS_PER_SEC); assert_equals(animation.playState, 'pending'); }, "Calling reverse() on a paused animation"); @@ -294,15 +294,15 @@ var animation = createPausedAnimation(t); animation.currentTime = 1 * MS_PER_SEC; assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 1 * MS_PER_SEC); + assert_times_equal(animation.currentTime, 1 * MS_PER_SEC); assert_equals(animation.playState, 'paused'); }, "Setting currentTime on a paused animation"); test(function(t) { var animation = createPausedAnimation(t); animation.startTime = document.timeline.currentTime - 1 * MS_PER_SEC; - assert_equals(animation.startTime, document.timeline.currentTime - 1 * MS_PER_SEC); - assert_equals(animation.currentTime, 1 * MS_PER_SEC); + assert_times_equal(animation.startTime, document.timeline.currentTime - 1 * MS_PER_SEC); + assert_times_equal(animation.currentTime, 1 * MS_PER_SEC); assert_equals(animation.playState, 'running'); }, "Setting startTime on a paused animation"); @@ -310,7 +310,7 @@ var animation = createFinishedAnimation(t); animation.play(); assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 0); + assert_times_equal(animation.currentTime, 0); assert_equals(animation.playState, 'pending'); }, "Calling play() on a finished animation"); @@ -318,7 +318,7 @@ var animation = createFinishedAnimation(t); animation.pause(); assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 100 * MS_PER_SEC); + assert_times_equal(animation.currentTime, 100 * MS_PER_SEC); assert_equals(animation.playState, 'pending'); }, "Calling pause() on a finished animation"); @@ -333,8 +333,8 @@ test(function(t) { var animation = createFinishedAnimation(t); animation.finish(); - assert_equals(animation.startTime, document.timeline.currentTime - animation.currentTime); - assert_equals(animation.currentTime, 100 * MS_PER_SEC); + assert_times_equal(animation.startTime, document.timeline.currentTime - animation.currentTime); + assert_times_equal(animation.currentTime, 100 * MS_PER_SEC); assert_equals(animation.playState, 'finished'); }, "Calling finish() on a finished animation"); @@ -342,15 +342,15 @@ var animation = createFinishedAnimation(t); animation.reverse(); assert_equals(animation.startTime, null); - assert_equals(animation.currentTime, 100 * MS_PER_SEC); + assert_times_equal(animation.currentTime, 100 * MS_PER_SEC); assert_equals(animation.playState, 'pending'); }, "Calling reverse() on a finished animation"); test(function(t) { var animation = createFinishedAnimation(t); animation.currentTime = 1 * MS_PER_SEC; - assert_equals(animation.startTime, document.timeline.currentTime - animation.currentTime); - assert_equals(animation.currentTime, 1 * MS_PER_SEC); + assert_times_equal(animation.startTime, document.timeline.currentTime - animation.currentTime); + assert_times_equal(animation.currentTime, 1 * MS_PER_SEC); assert_equals(animation.playState, 'running'); }, "Setting currentTime on a finished animation"); From f1902369fc8645f3917a12289f65eb9b6e12904f Mon Sep 17 00:00:00 2001 From: Suzy Howlett Date: Thu, 14 Jul 2016 15:58:55 +1000 Subject: [PATCH 7/9] Use null keyframes since only testing timing --- .../animation-model/play-state/negative-playback-rate.html | 2 +- .../animation-model/play-state/positive-playback-rate.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/web-animations/animation-model/play-state/negative-playback-rate.html b/web-animations/animation-model/play-state/negative-playback-rate.html index 0266c3101ca8f0..00858a67e2a738 100644 --- a/web-animations/animation-model/play-state/negative-playback-rate.html +++ b/web-animations/animation-model/play-state/negative-playback-rate.html @@ -10,7 +10,7 @@ 'use strict'; function createIdleAnimation(t) { - var animation = createDiv(t).animate([], 100 * MS_PER_SEC); + var animation = createDiv(t).animate(null, 100 * MS_PER_SEC); animation.reverse(); animation.cancel(); return animation; diff --git a/web-animations/animation-model/play-state/positive-playback-rate.html b/web-animations/animation-model/play-state/positive-playback-rate.html index 9f4d4345b28167..d5c133573315dd 100644 --- a/web-animations/animation-model/play-state/positive-playback-rate.html +++ b/web-animations/animation-model/play-state/positive-playback-rate.html @@ -10,7 +10,7 @@ 'use strict'; function createIdleAnimation(t) { - var animation = createDiv(t).animate([], 100 * MS_PER_SEC); + var animation = createDiv(t).animate(null, 100 * MS_PER_SEC); animation.cancel(); return animation; } From ce33cc1943bb7adba7e5f2489b5a04c04c934e81 Mon Sep 17 00:00:00 2001 From: Suzy Howlett Date: Thu, 14 Jul 2016 16:39:37 +1000 Subject: [PATCH 8/9] Move play state tests under timing-model/animations Mistaken directory allocation earlier. --- .../animations/play-state-negative-playback-rate.html} | 0 .../animations/play-state.html} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename web-animations/{animation-model/play-state/negative-playback-rate.html => timing-model/animations/play-state-negative-playback-rate.html} (100%) rename web-animations/{animation-model/play-state/positive-playback-rate.html => timing-model/animations/play-state.html} (100%) diff --git a/web-animations/animation-model/play-state/negative-playback-rate.html b/web-animations/timing-model/animations/play-state-negative-playback-rate.html similarity index 100% rename from web-animations/animation-model/play-state/negative-playback-rate.html rename to web-animations/timing-model/animations/play-state-negative-playback-rate.html diff --git a/web-animations/animation-model/play-state/positive-playback-rate.html b/web-animations/timing-model/animations/play-state.html similarity index 100% rename from web-animations/animation-model/play-state/positive-playback-rate.html rename to web-animations/timing-model/animations/play-state.html From 8e29cfb65b411fa2bb2fda572cd74d8a54f73a11 Mon Sep 17 00:00:00 2001 From: Suzy Howlett Date: Thu, 14 Jul 2016 16:51:27 +1000 Subject: [PATCH 9/9] Response to review --- .../play-state-negative-playback-rate.html | 1 + .../timing-model/animations/play-state.html | 18 ++++++++---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/web-animations/timing-model/animations/play-state-negative-playback-rate.html b/web-animations/timing-model/animations/play-state-negative-playback-rate.html index 00858a67e2a738..8e3459e928f372 100644 --- a/web-animations/timing-model/animations/play-state-negative-playback-rate.html +++ b/web-animations/timing-model/animations/play-state-negative-playback-rate.html @@ -351,5 +351,6 @@ assert_times_equal(animation.currentTime, 1 * MS_PER_SEC); assert_equals(animation.playState, 'running'); }, "Setting currentTime on a finished animation"); + diff --git a/web-animations/timing-model/animations/play-state.html b/web-animations/timing-model/animations/play-state.html index d5c133573315dd..aa8ffb27c672df 100644 --- a/web-animations/timing-model/animations/play-state.html +++ b/web-animations/timing-model/animations/play-state.html @@ -369,18 +369,16 @@ }); }, "PlayState is 'running' while playing a cancelled animation"); -async_test(function(t) { - let animation = createRunningAnimation(t); +promise_test(function(t) { + var animation = createRunningAnimation(t); animation.pause(); - let animationCurrentTime = animation.currentTime; - animation.ready.then(() => { - t.step(() => { - assert_equals(animation.playState, 'paused'); - assert_equals(animation.startTime, null); - assert_greater_than_equal(animation.currentTime, animationCurrentTime); - }); - t.done(); + var animationCurrentTime = animation.currentTime; + return animation.ready.then(() => { + assert_equals(animation.playState, 'paused'); + assert_equals(animation.startTime, null); + assert_greater_than_equal(animation.currentTime, animationCurrentTime); }); }, "PlayState is 'running' while pausing a running animation"); +