Bug 1272211 - Part 2: Modified and append tests. r=birtles draft
authorDaisuke Akatsuka <daisuke@mozilla-japan.org>
Mon, 30 May 2016 09:01:21 +0900
changeset 372668 04c87f70e6bca7c68feacb3526e73c1ca4790331
parent 372667 4e80cd678bda83642822033ba1d4433fea40e336
child 522210 8f72e1dd489e1d70a6b07104fc857f9a0996c034
push id19557
push userbmo:daisuke@mozilla-japan.org
push dateMon, 30 May 2016 00:01:25 +0000
reviewersbirtles
bugs1272211
milestone49.0a1
Bug 1272211 - Part 2: Modified and append tests. r=birtles MozReview-Commit-ID: A9gGXe1vMal
testing/web-platform/meta/web-animations/interfaces/Animation/constructor.html.ini
testing/web-platform/tests/web-animations/interfaces/Animation/constructor.html
testing/web-platform/tests/web-animations/interfaces/Animation/reverse.html
testing/web-platform/tests/web-animations/timing-model/animations/set-the-animation-start-time.html
--- a/testing/web-platform/meta/web-animations/interfaces/Animation/constructor.html.ini
+++ b/testing/web-platform/meta/web-animations/interfaces/Animation/constructor.html.ini
@@ -2,8 +2,12 @@
   type: testharness
   [Animation can be constructed with null effect and null timeline]
     expected: FAIL
     bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1049975
 
   [Animation can be constructed with null effect and non-null timeline]
     expected: FAIL
     bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1049975
+
+  [Animation can be constructed with null effect and no timeline parameter]
+    expected: FAIL
+    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1049975
--- a/testing/web-platform/tests/web-animations/interfaces/Animation/constructor.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Animation/constructor.html
@@ -14,47 +14,66 @@
 
 var gTarget = document.getElementById("target");
 var gEffect = new KeyframeEffectReadOnly(gTarget, { opacity: [0, 1] });
 
 var gTestArguments = [
   {
     effect: null,
     timeline: null,
+    expectedTimeline: null,
+    expectedTimelineDescription: "null",
     description: "with null effect and null timeline"
   },
   {
     effect: null,
     timeline: document.timeline,
+    expectedTimeline: document.timeline,
+    expectedTimelineDescription: "document.timeline",
     description: "with null effect and non-null timeline"
   },
   {
+    effect: null,
+    expectedTimeline: document.timeline,
+    expectedTimelineDescription: "document.timeline",
+    description: "with null effect and no timeline parameter"
+  },
+  {
     effect: gEffect,
     timeline: null,
+    expectedTimeline: null,
+    expectedTimelineDescription: "null",
     description: "with non-null effect and null timeline"
   },
   {
     effect: gEffect,
     timeline: document.timeline,
+    expectedTimeline: document.timeline,
+    expectedTimelineDescription: "document.timeline",
     description: "with non-null effect and non-null timeline"
   },
+  {
+    effect: gEffect,
+    expectedTimeline: document.timeline,
+    expectedTimelineDescription: "document.timeline",
+    description: "with non-null effect and no timeline parameter"
+  },
 ];
 
 gTestArguments.forEach(function(args) {
   test(function(t) {
     var animation = new Animation(args.effect, args.timeline);
 
     assert_not_equals(animation, null,
                       "An animation sohuld be created");
     assert_equals(animation.effect, args.effect,
                   "Animation returns the same effect passed to " +
                   "the Constructor");
-    assert_equals(animation.timeline, args.timeline,
-                  "Animation returns the same timeline passed to " +
-                  "the Constructor");
+    assert_equals(animation.timeline, args.expectedTimeline,
+                  "Animation timeline should be " + args.expectedTimelineDescription);
     assert_equals(animation.playState, "idle",
                   "Animation.playState should be initially 'idle'");
   }, "Animation can be constructed " + args.description);
 });
 
 test(function(t) {
   var effect = new KeyframeEffectReadOnly(null,
                                           { left: ["10px", "20px"] },
@@ -64,10 +83,25 @@ test(function(t) {
   anim.pause();
   assert_equals(effect.getComputedTiming().progress, 0.0);
   anim.currentTime += 5000;
   assert_equals(effect.getComputedTiming().progress, 0.5);
   anim.finish();
   assert_equals(effect.getComputedTiming().progress, 1.0);
 }, "Animation constructed by an effect with null target runs normally");
 
+async_test(function(t) {
+  var iframe = document.createElement('iframe');
+
+  iframe.addEventListener('load', t.step_func(function() {
+    var div = createDiv(t, iframe.contentDocument);
+    var effect = new KeyframeEffectReadOnly(div, null, 10000);
+    var anim = new Animation(effect);
+    assert_equals(anim.timeline, document.timeline);
+    iframe.remove();
+    t.done();
+  }));
+
+  document.body.appendChild(iframe);
+}, "Animation constructed with a keyframe that target element is in iframe");
+
 </script>
 </body>
--- a/testing/web-platform/tests/web-animations/interfaces/Animation/reverse.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Animation/reverse.html
@@ -144,16 +144,16 @@ test(function(t) {
   assert_equals(animation.currentTime, 50 * MS_PER_SEC,
     'reverse() should not affect the currentTime if the playbackRate == 0');
   t.done();
 }, 'reverse() when playbackRate == 0');
 
 test(function(t) {
   var div = createDiv(t);
   var animation =
-   new Animation(new KeyframeEffect(div, null, 100 * MS_PER_SEC));
+    new Animation(new KeyframeEffect(div, null, 100 * MS_PER_SEC), null);
 
   assert_throws('InvalidStateError', function() { animation.reverse(); });
 }, 'Reversing an animation without an active timeline throws an ' +
    'InvalidStateError');
 
 </script>
 </body>
--- a/testing/web-platform/tests/web-animations/timing-model/animations/set-the-animation-start-time.html
+++ b/testing/web-platform/tests/web-animations/timing-model/animations/set-the-animation-start-time.html
@@ -11,17 +11,18 @@
 'use strict';
 
 test(function(t)
 {
   // It should only be possible to set *either* the start time or the current
   // time for an animation that does not have an active timeline.
 
   var animation =
-    new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC));
+    new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
+                  null);
 
   assert_equals(animation.currentTime, null, 'Intial current time');
   assert_equals(animation.startTime, null, 'Intial start time');
 
   animation.currentTime = 1000;
   assert_equals(animation.currentTime, 1000,
                 'Setting the current time succeeds');
   assert_equals(animation.startTime, null,
@@ -41,17 +42,18 @@ test(function(t)
 }, 'Setting the start time of an animation without an active timeline');
 
 test(function(t)
 {
   // Setting an unresolved start time on an animation without an active
   // timeline should not clear the current time.
 
   var animation =
-    new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC));
+    new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
+                  null);
 
   assert_equals(animation.currentTime, null, 'Intial current time');
   assert_equals(animation.startTime, null, 'Intial start time');
 
   animation.currentTime = 1000;
   assert_equals(animation.currentTime, 1000,
                 'Setting the current time succeeds');
   assert_equals(animation.startTime, null,