diff options
Diffstat (limited to 'tests/wpt/web-platform-tests/encrypted-media/scripts')
3 files changed, 24 insertions, 17 deletions
diff --git a/tests/wpt/web-platform-tests/encrypted-media/scripts/playback-retrieve-persistent-license.js b/tests/wpt/web-platform-tests/encrypted-media/scripts/playback-retrieve-persistent-license.js index e8d9d02be30..83cba34028e 100644 --- a/tests/wpt/web-platform-tests/encrypted-media/scripts/playback-retrieve-persistent-license.js +++ b/tests/wpt/web-platform-tests/encrypted-media/scripts/playback-retrieve-persistent-license.js @@ -74,12 +74,14 @@ function runTest(config,qualifier) { // Lisen for an event from the new window containing its test assertions window.addEventListener('message', test.step_func(function(messageEvent) { - messageEvent.data.forEach(test.step_func(function(assertion) { - assert_equals(assertion.actual, assertion.expected, assertion.message); - })); - - win.close(); - test.done(); + if (messageEvent.data.testResult) { + messageEvent.data.testResult.forEach(test.step_func(function(assertion) { + assert_equals(assertion.actual, assertion.expected, assertion.message); + })); + + win.close(); + test.done(); + } })); // Delete things which can't be cloned and posted over to the new window @@ -96,7 +98,8 @@ function runTest(config,qualifier) { return access.createMediaKeys(); }).then(function(mediaKeys) { _mediaKeys = mediaKeys; - _video.setMediaKeys( mediaKeys ); + return _video.setMediaKeys( mediaKeys ); + }).then(function() { _mediaKeySession = _mediaKeys.createSession('persistent-license'); waitForEventAndRunStep('encrypted', _video, onEncrypted, test); waitForEventAndRunStep('playing', _video, onPlaying, test); diff --git a/tests/wpt/web-platform-tests/encrypted-media/scripts/playback-retrieve-persistent-usage-record.js b/tests/wpt/web-platform-tests/encrypted-media/scripts/playback-retrieve-persistent-usage-record.js index 9467fd5d867..a04f97d2ca9 100644 --- a/tests/wpt/web-platform-tests/encrypted-media/scripts/playback-retrieve-persistent-usage-record.js +++ b/tests/wpt/web-platform-tests/encrypted-media/scripts/playback-retrieve-persistent-usage-record.js @@ -45,7 +45,7 @@ function runTest(config,qualifier) { config.messagehandler( event.messageType, event.message ).then(function(response) { return _mediaKeySession.update(response); }).then(function() { - _video.setMediaKeys(_mediaKeys); + return _video.setMediaKeys(_mediaKeys); }).catch(onFailure); } @@ -70,13 +70,17 @@ function runTest(config,qualifier) { _video.setMediaKeys( null ); var win = window.open(config.windowscript); - window.addEventListener('message', test.step_func(function(event) { - event.data.forEach(test.step_func(function(assertion) { - assert_equals(assertion.actual, assertion.expected, assertion.message); - })); + assert_not_equals(win, null, "Popup windows not allowed?"); - win.close(); - test.done(); + window.addEventListener('message', test.step_func(function(event) { + if (event.data.testResult) { + event.data.testResult.forEach(test.step_func(function(assertion) { + assert_equals(assertion.actual, assertion.expected, assertion.message); + })); + + win.close(); + test.done(); + } })); delete config.video; diff --git a/tests/wpt/web-platform-tests/encrypted-media/scripts/unique-origin.js b/tests/wpt/web-platform-tests/encrypted-media/scripts/unique-origin.js index ff1122db4de..015ea9d4e92 100644 --- a/tests/wpt/web-platform-tests/encrypted-media/scripts/unique-origin.js +++ b/tests/wpt/web-platform-tests/encrypted-media/scripts/unique-origin.js @@ -10,7 +10,7 @@ function runTest(config) { resolve(iframe); }; iframe.sandbox = sandbox; - iframe.src = src; + iframe.srcdoc = src; document.documentElement.appendChild(iframe); }); } @@ -25,7 +25,7 @@ function runTest(config) { } promise_test(function (test) { - var script = 'data:text/html,' + + var script = '<script>' + ' window.onmessage = function(e) {' + ' navigator.requestMediaKeySystemAccess("' + config.keysystem + '", [{' + @@ -53,7 +53,7 @@ function runTest(config) { return access.createMediaKeys(); }).then(function (mediaKeys) { // Success, so now create the iframe and try there. - return load_iframe(script, 'allow-scripts'); + return load_iframe(script, 'allow-scripts allow-secure-context'); }).then(function (iframe) { iframe.contentWindow.postMessage({}, '*'); return wait_for_message(); |