| Index: LayoutTests/http/tests/media/encrypted-media/encrypted-media-encrypted-event-same-origin.html
|
| diff --git a/LayoutTests/http/tests/media/encrypted-media/encrypted-media-encrypted-event-same-origin.html b/LayoutTests/http/tests/media/encrypted-media/encrypted-media-encrypted-event-same-origin.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b042c07fc506259f9f09d5bc04e8a0661b9f4c62
|
| --- /dev/null
|
| +++ b/LayoutTests/http/tests/media/encrypted-media/encrypted-media-encrypted-event-same-origin.html
|
| @@ -0,0 +1,47 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| + <head>
|
| + <title>Initialization Data returned when using same 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>
|
| + <div id="log"></div>
|
| + <script>
|
| + async_test(function(test)
|
| + {
|
| + var video = document.getElementById('testVideo1');
|
| + 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 the same origin as this test,
|
| + // both initDataType and initData should contain something.
|
| + assert_equals(event.initDataType, 'webm');
|
| + assert_greater_than(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) {
|
| + video.src = 'test-encrypted.webm';
|
| + video.play();
|
| + });
|
| + }, 'Initialization Data returned when using same origin.');
|
| + </script>
|
| + </body>
|
| +</html>
|
|
|