OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Verify v2 events</title> | 4 <title>Verify v2 events</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> |
(...skipping 26 matching lines...) Expand all Loading... |
37 } | 37 } |
38 | 38 |
39 function processKeyStatusesChange(event) | 39 function processKeyStatusesChange(event) |
40 { | 40 { |
41 assert_true(event instanceof Event); | 41 assert_true(event instanceof Event); |
42 assert_equals(event.target, mediaKeySession); | 42 assert_equals(event.target, mediaKeySession); |
43 assert_equals(event.type, 'keystatuseschange'); | 43 assert_equals(event.type, 'keystatuseschange'); |
44 test.done(); | 44 test.done(); |
45 } | 45 } |
46 | 46 |
47 getSupportedInitDataType().then(function(type) { | 47 navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimp
leConfiguration()).then(function(access) { |
48 initDataType = type; | 48 initDataType = access.getConfiguration().initDataTypes[0]; |
49 initData = getInitData(initDataType); | 49 initData = getInitData(initDataType); |
50 return navigator.requestMediaKeySystemAccess('org.w3.clearke
y', [{}]); | |
51 }).then(function(access) { | |
52 return access.createMediaKeys(); | 50 return access.createMediaKeys(); |
53 }).then(test.step_func(function(mediaKeys) { | 51 }).then(test.step_func(function(mediaKeys) { |
54 mediaKeySession = mediaKeys.createSession(); | 52 mediaKeySession = mediaKeys.createSession(); |
55 waitForEventAndRunStep('message', mediaKeySession, test.step
_func(processMessage), test); | 53 waitForEventAndRunStep('message', mediaKeySession, test.step
_func(processMessage), test); |
56 return mediaKeySession.generateRequest(initDataType, initDat
a); | 54 return mediaKeySession.generateRequest(initDataType, initDat
a); |
57 })).catch(test.step_func(function(error) { | 55 })).catch(test.step_func(function(error) { |
58 forceTestFailureFromPromise(test, error); | 56 forceTestFailureFromPromise(test, error); |
59 })); | 57 })); |
60 }, 'Verify v2 events.'); | 58 }, 'Verify v2 events.'); |
61 </script> | 59 </script> |
62 </body> | 60 </body> |
63 </html> | 61 </html> |
OLD | NEW |