Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Unified Diff: LayoutTests/http/tests/media/encrypted-media/encrypted-media-encrypted-event-same-origin.html

Issue 893123004: Check origin before providing initData in encrypted event (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: nits Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..775221275d9f6dcae89ba8673de7471c9117addd
--- /dev/null
+++ b/LayoutTests/http/tests/media/encrypted-media/encrypted-media-encrypted-event-same-origin.html
@@ -0,0 +1,46 @@
+<!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="testVideo"></video>
+ <div id="log"></div>
+ <script>
+ async_test(function(test)
+ {
+ var video = document.getElementById('testVideo');
+ 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>

Powered by Google App Engine
This is Rietveld 408576698