Bug 1398038 - Drop redundant exception data from gInvalidKeyframesTests and gInvalidKeyframeEffectOptionTests; r?hiro draft
authorBrian Birtles <birtles@gmail.com>
Wed, 18 Oct 2017 14:12:16 +0900
changeset 683760 73670b56f52537e3586b79d13532084cba88a497
parent 683759 58d28e186b0e432d688155fdd19378c7936257fb
child 683761 e097916729f275508a306e757925d62cb1a6cb25
push id85456
push userbmo:bbirtles@mozilla.com
push dateFri, 20 Oct 2017 06:31:55 +0000
reviewershiro
bugs1398038
milestone58.0a1
Bug 1398038 - Drop redundant exception data from gInvalidKeyframesTests and gInvalidKeyframeEffectOptionTests; r?hiro The data is always the same so there's no need to repeat it here. MozReview-Commit-ID: 35OmrbyGq24
testing/web-platform/tests/web-animations/interfaces/Animatable/animate.html
testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/constructor.html
testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/setKeyframes.html
testing/web-platform/tests/web-animations/resources/keyframe-tests.js
--- a/testing/web-platform/tests/web-animations/interfaces/Animatable/animate.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Animatable/animate.html
@@ -88,17 +88,17 @@ gKeyframesTests.forEach(function(subtest
     var anim = div.animate(subtest.input, 2000);
     assert_frame_lists_equal(anim.effect.getKeyframes(), subtest.output);
   }, 'Element.animate() accepts ' + subtest.desc);
 });
 
 gInvalidKeyframesTests.forEach(function(subtest) {
   test(function(t) {
     var div = createDiv(t);
-    assert_throws(subtest.expected, function() {
+    assert_throws(new TypeError, function() {
       div.animate(subtest.input, 2000);
     });
   }, 'Element.animate() does not accept ' + subtest.desc);
 });
 
 gInvalidEasings.forEach(invalidEasing => {
   test(function(t) {
     var div = createDiv(t);
--- a/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/constructor.html
+++ b/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/constructor.html
@@ -119,17 +119,17 @@ gKeyframesTests.forEach(function(subtest
     assert_frame_lists_equal(secondEffect.getKeyframes(),
                              effect.getKeyframes());
   }, "a KeyframeEffectReadOnly constructed with " + subtest.desc +
      " roundtrips");
 });
 
 gInvalidKeyframesTests.forEach(function(subtest) {
   test(function(t) {
-    assert_throws(subtest.expected, function() {
+    assert_throws(new TypeError, function() {
       new KeyframeEffectReadOnly(target, subtest.input);
     });
   }, "KeyframeEffectReadOnly constructor throws with " + subtest.desc);
 });
 
 test(function(t) {
   var effect = new KeyframeEffectReadOnly(target,
                                           { left: ["10px", "20px"] });
@@ -174,17 +174,17 @@ gKeyframeEffectOptionTests.forEach(funct
     assert_equals(timing.direction, expected("direction", "normal"),
                   "timing direction");
 
   }, "a KeyframeEffectReadOnly constructed by " + stest.desc);
 });
 
 gInvalidKeyframeEffectOptionTests.forEach(function(stest) {
   test(function(t) {
-    assert_throws(stest.expected, function() {
+    assert_throws(new TypeError, function() {
       new KeyframeEffectReadOnly(target,
                                  { left: ["10px", "20px"] },
                                  stest.input);
     });
   }, "Invalid KeyframeEffectReadOnly option by " + stest.desc);
 });
 
 test(function(t) {
--- a/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/setKeyframes.html
+++ b/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/setKeyframes.html
@@ -29,15 +29,15 @@ gKeyframesTests.forEach(function(subtest
     effect.setKeyframes(subtest.input);
     assert_frame_lists_equal(effect.getKeyframes(), subtest.output);
   }, 'Keyframes can be replaced with ' + subtest.desc);
 });
 
 gInvalidKeyframesTests.forEach(function(subtest) {
   test(function(t) {
     var effect = new KeyframeEffect(target, {});
-    assert_throws(subtest.expected, function() {
+    assert_throws(new TypeError, function() {
       effect.setKeyframes(subtest.input);
     });
   }, 'KeyframeEffect constructor throws with ' + subtest.desc);
 });
 </script>
 </body>
--- a/testing/web-platform/tests/web-animations/resources/keyframe-tests.js
+++ b/testing/web-platform/tests/web-animations/resources/keyframe-tests.js
@@ -417,52 +417,46 @@ const gKeyframesTests = [
              keyframe(offset(0.5), { left: '300px' }, 'linear'),
              keyframe(offset(1),   { left: '400px' }, 'ease-out'),
              keyframe(offset(1),   { left: '500px' }, 'steps(1)')],
   },
 ];
 
 const gInvalidKeyframesTests = [
   {
-    desc:     'keyframes with an out-of-bounded positive offset',
-    input:    [ { opacity: 0 },
-                { opacity: 0.5, offset: 2 },
-                { opacity: 1 } ],
-    expected: { name: 'TypeError' },
+    desc:  'keyframes with an out-of-bounded positive offset',
+    input: [ { opacity: 0 },
+             { opacity: 0.5, offset: 2 },
+             { opacity: 1 } ],
   },
   {
-    desc:     'keyframes with an out-of-bounded negative offset',
-    input:    [ { opacity: 0 },
-                { opacity: 0.5, offset: -1 },
-                { opacity: 1 } ],
-    expected: { name: 'TypeError' },
+    desc:  'keyframes with an out-of-bounded negative offset',
+    input: [ { opacity: 0 },
+             { opacity: 0.5, offset: -1 },
+             { opacity: 1 } ],
   },
   {
-    desc:     'keyframes not loosely sorted by offset',
-    input:    [ { opacity: 0, offset: 1 },
-                { opacity: 1, offset: 0 } ],
-    expected: { name: 'TypeError' },
+    desc:  'keyframes not loosely sorted by offset',
+    input: [ { opacity: 0, offset: 1 },
+             { opacity: 1, offset: 0 } ],
   },
   {
-    desc:     'property-indexed keyframes with an invalid easing value',
-    input:    { opacity: [ 0, 0.5, 1 ],
-                easing: 'inherit' },
-    expected: { name: 'TypeError' },
+    desc:  'property-indexed keyframes with an invalid easing value',
+    input: { opacity: [ 0, 0.5, 1 ],
+             easing: 'inherit' },
   },
   {
-    desc:     'a keyframe sequence with an invalid easing value',
-    input:    [ { opacity: 0, easing: 'jumpy' },
-                { opacity: 1 } ],
-    expected: { name: 'TypeError' },
+    desc:  'a keyframe sequence with an invalid easing value',
+    input: [ { opacity: 0, easing: 'jumpy' },
+             { opacity: 1 } ],
   },
   {
-    desc:     'keyframes with an invalid composite value',
-    input:    [ { opacity: 0, composite: 'alternate' },
-                { opacity: 1 } ],
-    expected: { name: 'TypeError' },
+    desc:  'keyframes with an invalid composite value',
+    input: [ { opacity: 0, composite: 'alternate' },
+             { opacity: 1 } ],
   },
 ];
 
 // ------------------------------
 //  KeyframeEffectOptions
 // ------------------------------
 
 const gKeyframeEffectOptionTests = [
@@ -517,57 +511,25 @@ const gKeyframeEffectOptionTests = [
   {
     desc:     'a forwards fill',
     input:    { fill: 'forwards' },
     expected: { fill: 'forwards' },
   }
 ];
 
 const gInvalidKeyframeEffectOptionTests = [
-  { desc:     '-Infinity',
-    input:    -Infinity,
-    expected: { name: 'TypeError' } },
-  { desc:     'NaN',
-    input:    NaN,
-    expected: { name: 'TypeError' } },
-  { desc:     'a negative value',
-    input:    -1,
-    expected: { name: 'TypeError' } },
-  { desc:     'a negative Infinity duration',
-    input:    { duration: -Infinity },
-    expected: { name: 'TypeError' } },
-  { desc:     'a NaN duration',
-    input:    { duration: NaN },
-    expected: { name: 'TypeError' } },
-  { desc:     'a negative duration',
-    input:    { duration: -1 },
-    expected: { name: 'TypeError' } },
-  { desc:     'a string duration',
-    input:    { duration: 'merrychristmas' },
-    expected: { name: 'TypeError' } },
-  { desc:     'a negative Infinity iterations',
-    input:    { iterations: -Infinity},
-    expected: { name: 'TypeError' } },
-  { desc:     'a NaN iterations',
-    input:    { iterations: NaN },
-    expected: { name: 'TypeError' } },
-  { desc:     'a negative iterations',
-    input:    { iterations: -1 },
-    expected: { name: 'TypeError' } },
-  { desc:     'a blank easing',
-    input:    { easing: '' },
-    expected: { name: 'TypeError' } },
-  { desc:     'an unrecognized easing',
-    input:    { easing: 'unrecognised' },
-    expected: { name: 'TypeError' } },
-  { desc:     'an \'initial\' easing',
-    input:    { easing: 'initial' },
-    expected: { name: 'TypeError' } },
-  { desc:     'an \'inherit\' easing',
-    input:    { easing: 'inherit' },
-    expected: { name: 'TypeError' } },
-  { desc:     'a variable easing',
-    input:    { easing: 'var(--x)' },
-    expected: { name: 'TypeError' } },
-  { desc:     'a multi-value easing',
-    input:    { easing: 'ease-in-out, ease-out' },
-    expected: { name: 'TypeError' } }
+  { desc: '-Infinity', input: -Infinity },
+  { desc: 'NaN', input: NaN },
+  { desc: 'a negative value', input: -1 },
+  { desc: 'a negative Infinity duration', input: { duration: -Infinity } },
+  { desc: 'a NaN duration', input: { duration: NaN } },
+  { desc: 'a negative duration', input: { duration: -1 } },
+  { desc: 'a string duration', input: { duration: 'merrychristmas' } },
+  { desc: 'a negative Infinity iterations', input: { iterations: -Infinity} },
+  { desc: 'a NaN iterations', input: { iterations: NaN } },
+  { desc: 'a negative iterations', input: { iterations: -1 } },
+  { desc: 'a blank easing', input: { easing: '' } },
+  { desc: 'an unrecognized easing', input: { easing: 'unrecognised' } },
+  { desc: 'an \'initial\' easing', input: { easing: 'initial' } },
+  { desc: 'an \'inherit\' easing', input: { easing: 'inherit' } },
+  { desc: 'a variable easing', input: { easing: 'var(--x)' } },
+  { desc: 'a multi-value easing', input: { easing: 'ease-in-out, ease-out' } },
 ];