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

Side by Side Diff: LayoutTests/media/encrypted-media/encrypted-media-session-closed-event.html

Issue 1004843003: Use requestMediaKeySystemAccess() to check type support in EME layout tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Changes Created 5 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Test MediaKeySession closed event</title> 4 <title>Test MediaKeySession closed event</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 <div id="log"></div> 10 <div id="log"></div>
11 <script> 11 <script>
12 async_test(function(test) 12 async_test(function(test)
13 { 13 {
14 var initDataType;
15 var initData;
14 var mediaKeySession; 16 var mediaKeySession;
15 navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).t hen(function(access) { 17 getSupportedInitDataType().then(function(type) {
18 initDataType = type;
19 initData = getInitData(initDataType);
20 return navigator.requestMediaKeySystemAccess('org.w3.clearke y', [{}]);
21 }).then(function(access) {
16 return access.createMediaKeys(); 22 return access.createMediaKeys();
17 }).then(function(mediaKeys) { 23 }).then(function(mediaKeys) {
18 var initDataType = getInitDataType();
19 mediaKeySession = mediaKeys.createSession(); 24 mediaKeySession = mediaKeys.createSession();
20 return mediaKeySession.generateRequest(initDataType, getInit Data(initDataType)); 25 return mediaKeySession.generateRequest(initDataType, initDat a);
21 }).then(function() { 26 }).then(function() {
22 // Wait for the session to be closed. 27 // Wait for the session to be closed.
23 mediaKeySession.closed.then(function(result) { 28 mediaKeySession.closed.then(function(result) {
24 assert_equals(result, undefined); 29 assert_equals(result, undefined);
25 // Now that the session is closed, verify that the 30 // Now that the session is closed, verify that the
26 // closed attribute immediately returns a fulfilled 31 // closed attribute immediately returns a fulfilled
27 // promise. 32 // promise.
28 return mediaKeySession.closed; 33 return mediaKeySession.closed;
29 }).then(function(result) { 34 }).then(function(result) {
30 assert_equals(result, undefined); 35 assert_equals(result, undefined);
31 test.done(); 36 test.done();
32 }); 37 });
33 38
34 // release() should result in the closed promise being 39 // release() should result in the closed promise being
35 // fulfilled. 40 // fulfilled.
36 return mediaKeySession.close(); 41 return mediaKeySession.close();
37 }).catch(function(error) { 42 }).catch(function(error) {
38 forceTestFailureFromPromise(test, error); 43 forceTestFailureFromPromise(test, error);
39 }); 44 });
40 }, 'Test MediaKeySession closed event.'); 45 }, 'Test MediaKeySession closed event.');
41 </script> 46 </script>
42 </body> 47 </body>
43 </html> 48 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698