Chromium Code Reviews| Index: LayoutTests/http/tests/media/encrypted-media/encrypted-media-encrypted-event-different-origin.html |
| diff --git a/LayoutTests/http/tests/media/encrypted-media/encrypted-media-encrypted-event-different-origin.html b/LayoutTests/http/tests/media/encrypted-media/encrypted-media-encrypted-event-different-origin.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3026ec3b7d3b9e853d2f38cb1a69424fcd5b1532 |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/media/encrypted-media/encrypted-media-encrypted-event-different-origin.html |
| @@ -0,0 +1,50 @@ |
| +<!DOCTYPE html> |
| +<html> |
| + <head> |
| + <title>Initialization Data not returned when using different origin</title> |
| + <script src="/js-test-resources/testharness.js"></script> |
| + <script src="/js-test-resources/testharnessreport.js"></script> |
| + </head> |
| + <body> |
| + <video id="testVideo1"></video> |
| + <video id="testVideo2"></video> |
|
jrummell
2015/02/07 00:12:26
Don't need both video elements -- I'll fix it.
jrummell
2015/02/07 02:11:47
Done.
|
| + <div id="log"></div> |
| + <script> |
| + async_test(function(test) |
| + { |
| + var video = document.getElementById('testVideo2'); |
| + var encryptedEventCount = 0; |
| + |
| + function onEncrypted(event) |
| + { |
| + assert_equals(event.target, video); |
| + assert_true(event instanceof window.MediaEncryptedEvent); |
| + assert_equals(event.type, 'encrypted'); |
| + |
| + // Since the .src is in a different origin as this test, |
| + // both initDataType and initData should be empty. |
| + assert_equals(event.initDataType, ''); |
| + assert_equals(event.initData.byteLength, 0); |
| + |
| + // Both the audio and the video tracks have initData, |
| + // so finish once both events are received. |
| + if (++encryptedEventCount == 2) |
| + test.done(); |
| + } |
| + |
| + navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) { |
| + return access.createMediaKeys(); |
| + }).then(function(mediaKeys) { |
| + video.addEventListener('encrypted', test.step_func(onEncrypted), true); |
| + return video.setMediaKeys(mediaKeys); |
| + }).then(function(result) { |
| + // Verify that the current origin is different than what |
| + // we use for the content. |
| + assert_equals(document.origin, 'http://127.0.0.1:8000'); |
| + video.src = 'http://127.0.0.1:8080/media/encrypted-media/test-encrypted.webm'; |
| + video.play(); |
| + }); |
| + }, 'Initialization Data not returned when using different origin.'); |
| + </script> |
| + </body> |
| +</html> |