| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Prefixed and unprefixed EME API</title> | 4 <title>Prefixed and unprefixed EME API</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 <p>Call prefixed EME API after unprefixed EME API.</p> | 12 <p>Call prefixed EME API after unprefixed EME API.</p> |
| 13 <script> | 13 <script> |
| 14 async_test(function(test) | 14 async_test(function(test) |
| 15 { | 15 { |
| 16 var video = document.getElementById('testVideo'); | 16 var video = document.getElementById('testVideo'); |
| 17 assert_not_equals(video, null); | 17 assert_not_equals(video, null); |
| 18 | 18 |
| 19 function loadStarted() | 19 function loadStarted() |
| 20 { | 20 { |
| 21 MediaKeys.create('org.w3.clearkey').then(function(mediaKeys)
{ | 21 navigator.requestMediaKeySystemAccess('org.w3.clearkey').the
n(function(access) { |
| 22 assert_equals(access.keySystem, 'org.w3.clearkey'); |
| 23 return access.createMediaKeys(); |
| 24 }).then(function(mediaKeys) { |
| 22 assert_not_equals(mediaKeys, null); | 25 assert_not_equals(mediaKeys, null); |
| 23 assert_equals(mediaKeys.keySystem, 'org.w3.clearkey'); | |
| 24 return video.setMediaKeys(mediaKeys); | 26 return video.setMediaKeys(mediaKeys); |
| 25 }).then(function(result) { | 27 }).then(function(result) { |
| 26 assert_throws('InvalidStateError', | 28 assert_throws('InvalidStateError', |
| 27 function () { video.webkitGenerateKeyReque
st('webkit-org.w3.clearkey'); }); | 29 function () { video.webkitGenerateKeyReque
st('webkit-org.w3.clearkey'); }); |
| 28 test.done(); | 30 test.done(); |
| 29 }).catch(function(error) { | 31 }).catch(function(error) { |
| 30 forceTestFailureFromPromise(test, error); | 32 forceTestFailureFromPromise(test, error); |
| 31 }); | 33 }); |
| 32 } | 34 } |
| 33 | 35 |
| 34 video.src = '../content/test-encrypted.webm'; | 36 video.src = '../content/test-encrypted.webm'; |
| 35 waitForEventAndRunStep('loadstart', video, loadStarted, test); | 37 waitForEventAndRunStep('loadstart', video, loadStarted, test); |
| 36 }, 'Call prefixed EME API after unprefixed EME API.'); | 38 }, 'Call prefixed EME API after unprefixed EME API.'); |
| 37 </script> | 39 </script> |
| 38 </body> | 40 </body> |
| 39 </html> | 41 </html> |
| OLD | NEW |