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

Unified Diff: LayoutTests/media/encrypted-media/encrypted-media-playback-multiple-sessions.html

Issue 203323006: Add layout test for EME WD using multiple sessions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove webM file Created 6 years, 9 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
« no previous file with comments | « no previous file | LayoutTests/media/encrypted-media/encrypted-media-playback-multiple-sessions-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/media/encrypted-media/encrypted-media-playback-multiple-sessions.html
diff --git a/LayoutTests/media/encrypted-media/encrypted-media-playback-multiple-sessions.html b/LayoutTests/media/encrypted-media/encrypted-media-playback-multiple-sessions.html
new file mode 100644
index 0000000000000000000000000000000000000000..f831e0c9622c5a1d6fb3a3b655e652dd07f60102
--- /dev/null
+++ b/LayoutTests/media/encrypted-media/encrypted-media-playback-multiple-sessions.html
@@ -0,0 +1,96 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Clear Key Playback with Multiple Sessions</title>
+ <script src="encrypted-media-utils.js"></script>
+ <script src="../w3c-media-utils.js"></script>
+ <script src="../../resources/testharness.js"></script>
+ <script src="../../resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <video id="testVideo"></video>
+ <div id="log"></div>
+ <p>Test playback of encrypted media using Clear Key key system with multiple sessions.</p>
+ <script>
+ setup({ timeout: 60000 }); // Timeout for all tests to run.
+
+ async_test(function(test)
+ {
+ var video = document.getElementById("testVideo");
+ var mediaKeys = new MediaKeys("org.w3.clearkey");
+ var audioMediaKeySession = null;
+ var videoMediaKeySession = null;
+ var audioKeyProvided = false;
+ var videoKeyProvided = false;
+
+ // The 2 streams use different key ids and different keys.
+ var audioKeyId = "1234567890123456";
+ var audioKey = new Uint8Array([0x30, 0x30, 0x62, 0xF1, 0x68, 0x14, 0xD2, 0x7B,
+ 0x68, 0xEF, 0x12, 0x2A, 0xFC, 0xE4, 0xAE, 0x0A]);
+ var videoKeyId = "0123456789012345";
+ var videoKey = new Uint8Array([0x7A, 0x7A, 0x62, 0xF1, 0x68, 0x14, 0xD2, 0x7B,
+ 0x68, 0xEF, 0x12, 0x2A, 0xFC, 0xE4, 0xAE, 0x0A]);
+
+ function onNeedKey(event)
+ {
+ var keyId = String.fromCharCode.apply(null, event.initData);
+ var newSession = mediaKeys.createSession(event.contentType, event.initData);
+ if (keyId == videoKeyId) {
+ assert_equals(videoMediaKeySession, null);
+ videoMediaKeySession = newSession;
+ } else {
+ assert_equals(keyId, audioKeyId);
+ assert_equals(audioMediaKeySession, null);
+ audioMediaKeySession = newSession;
+ }
+ waitForEventAndRunStep("message", newSession, onMessage, test);
+ }
+
+ function onMessage(event)
+ {
+ var keyId = event.message;
+ if (event.target == videoMediaKeySession) {
+ assert_equals(String.fromCharCode.apply(null, keyId), videoKeyId);
+ var jwkSet = stringToUint8Array(createJWKSet(createJWK(keyId, videoKey)));
+ videoMediaKeySession.update(jwkSet);
+ videoKeyProvided = true;
+ } else {
+ assert_equals(event.target, audioMediaKeySession);
+ assert_equals(String.fromCharCode.apply(null, keyId), audioKeyId);
+ var jwkSet = stringToUint8Array(createJWKSet(createJWK(keyId, audioKey)));
+ audioMediaKeySession.update(jwkSet);
+ audioKeyProvided = true;
+ }
+ }
+
+ function onPlaying(event)
+ {
+ // Video should not start playing until both keys have been
+ // provided.
xhwang 2014/03/22 00:56:49 Did you verify this? It used to be the case if aud
jrummell 2014/03/22 06:42:37 I did. If you comment out either of the 2 update()
+ assert_true(videoKeyProvided);
+ assert_true(audioKeyProvided);
+
+ // Not using waitForEventAndRunStep() to avoid too many
+ // EVENT(onTimeUpdate) logs.
+ video.addEventListener("timeupdate", onTimeUpdate, true);
+ }
+
+ function onTimeUpdate(event)
+ {
+ if (event.target.currentTime < 0.2)
+ return;
+
+ test.done();
+ }
+
+ waitForEventAndRunStep("needkey", video, onNeedKey, test);
+ waitForEventAndRunStep("playing", video, onPlaying, test);
+
+ video.src = "../content/test-encrypted-different-av-keys.webm";
+ video.setMediaKeys(mediaKeys);
+ video.play();
+ }, "Playback using Clear Key key system with multiple sessions.",
+ { timeout: 60000 });
+ </script>
+ </body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/media/encrypted-media/encrypted-media-playback-multiple-sessions-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698