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

Unified Diff: LayoutTests/web-animations-api/start-time-grouping.html

Issue 1341673002: Web Animations: Don't participate in grouping when start time is set (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Don't use 0 Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/web-animations-api/start-time-grouping.html
diff --git a/LayoutTests/web-animations-api/start-time-grouping.html b/LayoutTests/web-animations-api/start-time-grouping.html
new file mode 100644
index 0000000000000000000000000000000000000000..7157ec4e64297865c00893e745cdcf3cf458d1c1
--- /dev/null
+++ b/LayoutTests/web-animations-api/start-time-grouping.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<style>
+div {
+ width: 50px;
+ height: 50px;
+ background: green;
+}
+</style>
+<div id=target1></div>
+<div id=target2></div>
+<script>
+var anim1, anim2;
+anim1 = target1.animate([
+ {transform: 'none'},
+ {transform: 'translateX(500px)'},
+], 1000);
+
+function awaitFrame(frameTest) {
+ return new Promise(resolve => {
+ requestAnimationFrame(() => {
+ if (frameTest()) {
+ resolve();
+ } else {
+ awaitFrame(frameTest).then(resolve);
+ }
+ });
+ });
+}
+
+awaitFrame(() => anim1.currentTime > 100).then(() => {
+ requestAnimationFrame(t => {
+ // Testing a regression where scheduling anim1 and anim2 together caused anim2
+ // to get anim1's start time.
+ anim1.startTime = t - 100;
+ anim2 = target2.animate([
+ {transform: 'none'},
+ {transform: 'translateX(500px)'},
+ ], 200);
+ });
+});
+
+async_test(t => {
+ awaitFrame(() => anim2 && anim2.startTime != null).then(() => {
+ t.step(() => assert_not_equals(Math.round(anim1.startTime), Math.round(anim2.startTime)));
+ t.done();
+ });
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698