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

Unified Diff: third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-reset-src-during-setmediakeys.html

Issue 2703993002: media: Resolve pending SetCdm() when WebMediaPlayerImpl is destructed (Closed)
Patch Set: comments addressed Created 3 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: third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-reset-src-during-setmediakeys.html
diff --git a/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-reset-src-during-setmediakeys.html b/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-reset-src-during-setmediakeys.html
new file mode 100644
index 0000000000000000000000000000000000000000..eb7a65d050cc068c0733f7036ae51ca619c93b6e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-reset-src-during-setmediakeys.html
@@ -0,0 +1,73 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Reset src during setMediaKeys()</title>
+ <script src="encrypted-media-utils.js"></script>
+ <script src="../../resources/testharness.js"></script>
+ <script src="../../resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <video></video>
+ <script>
+ async_test(function(test)
+ {
+ var mediaKeys;
+ var video = document.querySelector('video');
+ assert_not_equals(video, null);
+ var encryptedEventIndex = 0;
+
+ // Content to be played. These files must be the same format.
+ var content = '../content/test-encrypted.webm';
+ var alternateContent = '../content/test-encrypted-different-av-keys.webm';
+
+ function setMediaKeys() {
+ // Create a MediaKeys object and assign it to video.
+ video.setMediaKeys(mediaKeys)
+ .then(function(result) {
+ // setMediaKeys() should succeed even if src is reset before setMediaKeys() promise is resolved.
+ assert_not_equals(video.mediaKeys, null, 'set successfully');
+ assert_true(video.mediaKeys === mediaKeys);
+ })
+ .catch(function(error) {
+ forceTestFailureFromPromise(test, error);
+ });
+ }
+
+ var onEncrypted = function(event)
+ {
+ encryptedEventIndex++;
+
+ // This event is fired once for the audio stream and once
+ // for the video stream each time .src is set.
+ if (encryptedEventIndex == 2) {
+ assert_equals(video.mediaKeys, null);
+ setMediaKeys();
+
+ // Reset src without waiting for setMediaKeys() to finish.
+ video.src = alternateContent;
+ } else if (encryptedEventIndex == 4) {
+ // Finished second video.
+ test.done();
+ }
+ };
+
+ navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(content))
+ .then(function(access) {
+ assert_equals(access.keySystem, 'org.w3.clearkey');
+ return access.createMediaKeys();
+ })
+ .then(function(result) {
+ mediaKeys = result;
+ assert_not_equals(mediaKeys, null);
+
+ // Set src without setMediaKeys().
+ video.src = content;
+ waitForEventAndRunStep('encrypted', video, onEncrypted, test);
+ })
+ .catch(function(error) {
+ forceTestFailureFromPromise(test, error);
+ })
+ }, 'Reset src during setMediaKeys().');
+ </script>
+ </body>
+</html>
« no previous file with comments | « media/renderers/renderer_impl.cc ('k') | third_party/WebKit/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698