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

Side by Side Diff: LayoutTests/media/encrypted-media/encrypted-media-lifetime-mediakeys.html

Issue 665213002: Implement navigator.requestMediaKeySystemAccess() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add comment Created 6 years, 1 month 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 MediaKeys lifetime</title> 4 <title>Test MediaKeys lifetime</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 // Create a MediaKeys object and free immediately. 14 // Create a MediaKeys object and free immediately.
15 MediaKeys.create('org.w3.clearkey').then(function(result) { 15 navigator.requestMediaKeySystemAccess('org.w3.clearkey').then(fu nction(access) {
16 return access.createMediaKeys();
17 }).then(function(result) {
16 // Do nothing with the created object 18 // Do nothing with the created object
17 }).then(function(result) { 19 }).then(function(result) {
18 // No way to verify that MediaKeys object is actually 20 // No way to verify that MediaKeys object is actually
19 // collected, but make sure it doesn't crash. 21 // collected, but make sure it doesn't crash.
20 return createGCPromise(); 22 return createGCPromise();
21 }).then(function(result) { 23 }).then(function(result) {
22 test.done(); 24 test.done();
23 }).catch(function(error) { 25 }).catch(function(error) {
24 forceTestFailureFromPromise(test, error); 26 forceTestFailureFromPromise(test, error);
25 }); 27 });
26 }, 'Creating and destroying MediaKeys does not crash'); 28 }, 'Creating and destroying MediaKeys does not crash');
27 29
28 async_test(function(test) 30 async_test(function(test)
29 { 31 {
30 var mediaKeys; 32 var mediaKeys;
31 MediaKeys.create('org.w3.clearkey').then(function(result) { 33 navigator.requestMediaKeySystemAccess('org.w3.clearkey').then(fu nction(access) {
34 return access.createMediaKeys();
35 }).then(function(result) {
32 mediaKeys = result; 36 mediaKeys = result;
33 return createGCPromise(); 37 return createGCPromise();
34 }).then(function(result) { 38 }).then(function(result) {
35 // Check that the object still exists. 39 // Check that the object still exists.
36 assert_equals(mediaKeys.keySystem, 'org.w3.clearkey'); 40 assert_equals(typeof mediaKeys.createSession, 'function');
37 mediaKeys = null; 41 mediaKeys = null;
38 42
39 // Now that the reference is dropped, it should be 43 // Now that the reference is dropped, it should be
40 // collected. No way to verify that it is actually 44 // collected. No way to verify that it is actually
41 // collected, but make sure it doesn't crash. 45 // collected, but make sure it doesn't crash.
42 return createGCPromise(); 46 return createGCPromise();
43 }).then(function(result) { 47 }).then(function(result) {
44 test.done(); 48 test.done();
45 }).catch(function(error) { 49 }).catch(function(error) {
46 forceTestFailureFromPromise(test, error); 50 forceTestFailureFromPromise(test, error);
47 }); 51 });
48 }, 'MediaKeys is not collected as long as we have a reference'); 52 }, 'MediaKeys is not collected as long as we have a reference');
49 </script> 53 </script>
50 </body> 54 </body>
51 </html> 55 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698