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

Side by Side Diff: third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-reset-src-after-setmediakeys.html

Issue 2084053002: EME: Update tests so 'audioCapabilities' always provided (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changes (+rebase) Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Reset src after setMediaKeys()</title> 4 <title>Reset src after setMediaKeys()</title>
5 <script src="encrypted-media-utils.js"></script> 5 <script src="encrypted-media-utils.js"></script>
6 <script src="../../resources/testharness.js"></script> 6 <script src="../../resources/testharness.js"></script>
7 <script src="../../resources/testharnessreport.js"></script> 7 <script src="../../resources/testharnessreport.js"></script>
8 </head> 8 </head>
9 <body> 9 <body>
10 <video id="testVideo"></video> 10 <video id="testVideo"></video>
11 <div id="log"></div> 11 <div id="log"></div>
12 <script> 12 <script>
13 async_test(function(test) 13 async_test(function(test)
14 { 14 {
15 var mediaKeys; 15 var mediaKeys;
16 var encryptedEventIndex = 0; 16 var encryptedEventIndex = 0;
17 var video = document.getElementById('testVideo'); 17 var video = document.getElementById('testVideo');
18 assert_not_equals(video, null); 18 assert_not_equals(video, null);
19 19
20 // Content to be played. These files must be the same format.
21 var content = '../content/test-encrypted.webm';
22 var alternateContent = '../content/test-encrypted-different-av-k eys.webm';
23
20 var onEncrypted = function(event) 24 var onEncrypted = function(event)
21 { 25 {
22 ++encryptedEventIndex; 26 ++encryptedEventIndex;
23 assert_not_equals(video.mediaKeys, null); 27 assert_not_equals(video.mediaKeys, null);
24 assert_true(video.mediaKeys === mediaKeys); 28 assert_true(video.mediaKeys === mediaKeys);
25 29
26 // This event is fired once for the audio stream and once 30 // This event is fired once for the audio stream and once
27 // for the video stream each time .src is set. 31 // for the video stream each time .src is set.
28 if (encryptedEventIndex == 2) { 32 if (encryptedEventIndex == 2) {
29 // Finished first video; set src to a different video. 33 // Finished first video; set src to a different video.
30 video.src = '../content/test-encrypted-different-av-keys .webm'; 34 video.src = alternateContent;
31 } else if (encryptedEventIndex == 4) { 35 } else if (encryptedEventIndex == 4) {
32 // Finished second video. 36 // Finished second video.
33 test.done(); 37 test.done();
34 } 38 }
35 }; 39 };
36 40
37 // Create a MediaKeys object and assign it to video. 41 // Create a MediaKeys object and assign it to video.
38 navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]) 42 navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConf igurationForFile(content))
39 .then(function(access) { 43 .then(function(access) {
40 assert_equals(access.keySystem, 'org.w3.clearkey'); 44 assert_equals(access.keySystem, 'org.w3.clearkey');
41 return access.createMediaKeys(); 45 return access.createMediaKeys();
42 }).then(function(result) { 46 }).then(function(result) {
43 mediaKeys = result; 47 mediaKeys = result;
44 assert_not_equals(mediaKeys, null); 48 assert_not_equals(mediaKeys, null);
45 return video.setMediaKeys(mediaKeys); 49 return video.setMediaKeys(mediaKeys);
46 }).then(function(result) { 50 }).then(function(result) {
47 assert_not_equals(video.mediaKeys, null, 'not set initially' ); 51 assert_not_equals(video.mediaKeys, null, 'not set initially' );
48 assert_true(video.mediaKeys === mediaKeys); 52 assert_true(video.mediaKeys === mediaKeys);
49 53
50 // Set src to a video. 54 // Set src to a video.
51 waitForEventAndRunStep('encrypted', video, onEncrypted, test ); 55 waitForEventAndRunStep('encrypted', video, onEncrypted, test );
52 video.src = '../content/test-encrypted.webm'; 56 video.src = content;
53 }).catch(function(error) { 57 }).catch(function(error) {
54 forceTestFailureFromPromise(test, error); 58 forceTestFailureFromPromise(test, error);
55 }); 59 });
56 }, 'Reset src after setMediaKeys().'); 60 }, 'Reset src after setMediaKeys().');
57 </script> 61 </script>
58 </body> 62 </body>
59 </html> 63 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698