Bug 1313284 - Update some EME WPT to match upstream so that they now pass. r=gerald
authorChris Pearce <cpearce@mozilla.com>
Thu, 27 Oct 2016 19:08:12 +1300
changeset 346549 f54a5c5e0b2a0fb50eea3a17a8bfc52a7f728b9f
parent 346548 9de67ae226941715a65130b6c54589e136842203
child 346550 0694957ec0945847f3b73e222051a91641031666
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1313284
milestone52.0a1
Bug 1313284 - Update some EME WPT to match upstream so that they now pass. r=gerald We now pass almost all the upstream EME WPT, but out local copy is out of date, so we're failing some. So rather than mark them as expected fail, update the out copy so that the tests pass as expected. MozReview-Commit-ID: 7YnD6Dlc0HC
testing/web-platform/tests/encrypted-media/scripts/clearkey-update-non-ascii-input.js
testing/web-platform/tests/encrypted-media/scripts/invalid-license.js
testing/web-platform/tests/encrypted-media/scripts/syntax-mediakeysession.js
testing/web-platform/tests/encrypted-media/scripts/update-disallowed-input.js
--- a/testing/web-platform/tests/encrypted-media/scripts/clearkey-update-non-ascii-input.js
+++ b/testing/web-platform/tests/encrypted-media/scripts/clearkey-update-non-ascii-input.js
@@ -33,16 +33,16 @@ function runTest(config, qualifier)
                 +     '"kid":"MDEyMzQ1Njc4O\uDC00TAxMjM0NQ"'
                 + '}]}';
             messageEventFired = true;
             return messageEvent.target.update(stringToUint8Array(jwkSet));
         }).then(function () {
             assert_unreached('Error: update() should fail because the processed message has non-ASCII character.');
         }).catch(function (error) {
             if(messageEventFired){
-                assert_equals(error.name, 'InvalidAccessError');
+                assert_equals(error.name, 'TypeError');
             }
             else {
                 assert_unreached('Error: ' + error.name);
             }
         });
     }, testname);
 }
\ No newline at end of file
--- a/testing/web-platform/tests/encrypted-media/scripts/invalid-license.js
+++ b/testing/web-platform/tests/encrypted-media/scripts/invalid-license.js
@@ -19,15 +19,15 @@ function runTest(config)
             return promise;
         }).then(function (messageEvent) {
             messageEventFired = true;
             return messageEvent.target.update(invalidLicense);
         }).then(function () {
             assert_unreached('Error: update() should fail because of an invalid license.');
         }).catch(function (error) {
             if(messageEventFired) {
-                assert_equals(error.name, 'InvalidAccessError');
+                assert_equals(error.name, 'TypeError');
             } else {
                 assert_unreached('Error: ' + error.name);
             }
         });
     }, 'Update with invalid Clear Key license');
 }
\ No newline at end of file
--- a/testing/web-platform/tests/encrypted-media/scripts/syntax-mediakeysession.js
+++ b/testing/web-platform/tests/encrypted-media/scripts/syntax-mediakeysession.js
@@ -45,18 +45,20 @@ function runTest(config) {
             }
         },
         {
             exception: 'TypeError',
             func: function (mk5, type) {
                 return mk5.createSession().generateRequest(type, 1);
             }
         },
+        // (new Uint8Array(0)) returns empty array. So 'TypeError' should
+        // be returned.
         {
-            exception: 'InvalidAccessError',
+            exception: 'TypeError',
             func: function (mk6, type) {
                 return mk6.createSession().generateRequest(type, new Uint8Array(0));
             }
         }
     ];
     function generateRequestTestExceptions(){
         return new Promise(function(resolve, reject){
             isInitDataTypeSupported(keysystem, initDataType).then(function (isTypeSupported) {
@@ -173,22 +175,25 @@ function runTest(config) {
         }
     ];
     // This function checks that calling generateRequest() works for
     // various sessions. |testCase.func| creates a MediaKeySession
     // object, and then generateRequest() is called on that object. It
     // allows for an NotSupportedError to be generated and treated as a
     // success, if allowed. See comment above kCreateSessionTestCases.
     function test_generateRequest(testCase, mediaKeys, type, initData) {
+        var mediaKeySession;
         try {
-            var mediaKeySession = testCase.func.call(null, mediaKeys);
-            return mediaKeySession.generateRequest(type, initData);
+            mediaKeySession = testCase.func.call(null, mediaKeys);
         } catch (e) {
             assert_true(testCase.isNotSupportedAllowed);
+            assert_equals(e.name, 'NotSupportedError');
+            return Promise.resolve('not supported');
         }
+        return mediaKeySession.generateRequest(type, initData);
     }
     function generateRequestForVariousSessions(){
         return new Promise(function(resolve, reject){
             isInitDataTypeSupported(keysystem, initDataType).then(function (isTypeSupported) {
                     assert_true(isTypeSupported, "initDataType should be supported");
                     return navigator.requestMediaKeySystemAccess(keysystem, [configuration]);
                 }).then(function (access) {
                     return access.createMediaKeys();
@@ -242,18 +247,20 @@ function runTest(config) {
             }
         },
         {
             exception: 'TypeError',
             func: function (s) {
                 return s.update(1);
             }
         },
+        // (new Uint8Array(0)) returns empty array. So 'TypeError' should
+        // be returned.
         {
-            exception: 'InvalidAccessError',
+            exception: 'TypeError',
             func: function (s) {
                 return s.update(new Uint8Array(0));
             }
         }
     ];
 
     function updateTestExceptions(){
         return new Promise(function(resolve, reject){
@@ -314,24 +321,16 @@ function runTest(config) {
 
     function create_remove_exception_test(mediaKeys, type, initData) {
         // remove() on an uninitialized session should fail.
         var mediaKeySession = mediaKeys.createSession('temporary');
         return mediaKeySession.remove().then(function (result) {
                 assert_unreached('remove() should not succeed if session uninitialized');
             }, function (error) {
                 assert_equals(error.name, 'InvalidStateError');
-                // remove() on a temporary session should fail.
-                return mediaKeySession.generateRequest(type, initData);
-            }).then(function (result) {
-                return mediaKeySession.remove();
-            }).then(function () {
-                assert_unreached('remove() should not succeed for temporary sessions');
-            }, function (error) {
-                assert_equals(error.name, 'InvalidAccessError');
             });
     }
     function removeTestException(){
         return new Promise(function(resolve, reject){
             isInitDataTypeSupported(keysystem, initDataType).then(function (isTypeSupported) {
                     assert_true(isTypeSupported, "initDataType not supported");
                     return navigator.requestMediaKeySystemAccess(keysystem, [configuration]);
                 }).then(function (access) {
--- a/testing/web-platform/tests/encrypted-media/scripts/update-disallowed-input.js
+++ b/testing/web-platform/tests/encrypted-media/scripts/update-disallowed-input.js
@@ -34,12 +34,12 @@ function runTest(config)
         }).then(function () {
             var jwkSet = createReallyLongJWKSet();
             assert_greater_than(jwkSet.length, 65536);
             var jwkSetArray = stringToUint8Array(jwkSet);
             return mediaKeySession.update(jwkSetArray);
         }).then(function () {
             assert_unreached('update() with a response longer than 64Kb succeed');
         }).catch(function (error) {
-            assert_equals(error.name, 'InvalidAccessError');
+            assert_equals(error.name, 'TypeError');
         });
     }, 'update() with invalid response (longer than 64Kb characters) should fail.');
 }