Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / media / encrypted-media / encrypted-media-lifetime-mediakeys.html
blob39f923ccfff7b55ca101fc8ea78dc09991d48f9e
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Test MediaKeys lifetime</title>
5 <script src="encrypted-media-utils.js"></script>
6 <script src="../../resources/testharness.js"></script>
7 <script src="../../resources/testharnessreport.js"></script>
8 </head>
9 <body>
10 <div id="log"></div>
11 <script>
12 async_test(function(test)
14 // Create a MediaKeys object and free immediately.
15 navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
16 return access.createMediaKeys();
17 }).then(function(result) {
18 // Do nothing with the created object
19 }).then(function(result) {
20 // No way to verify that MediaKeys object is actually
21 // collected, but make sure it doesn't crash.
22 return createGCPromise();
23 }).then(function(result) {
24 test.done();
25 }).catch(function(error) {
26 forceTestFailureFromPromise(test, error);
27 });
28 }, 'Creating and destroying MediaKeys does not crash');
30 async_test(function(test)
32 var mediaKeys;
33 navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
34 return access.createMediaKeys();
35 }).then(function(result) {
36 mediaKeys = result;
37 return createGCPromise();
38 }).then(function(result) {
39 // Check that the object still exists.
40 assert_equals(typeof mediaKeys.createSession, 'function');
41 mediaKeys = null;
43 // Now that the reference is dropped, it should be
44 // collected. No way to verify that it is actually
45 // collected, but make sure it doesn't crash.
46 return createGCPromise();
47 }).then(function(result) {
48 test.done();
49 }).catch(function(error) {
50 forceTestFailureFromPromise(test, error);
51 });
52 }, 'MediaKeys is not collected as long as we have a reference');
53 </script>
54 </body>
55 </html>