Chromium Code Reviews| 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 unprefixed EME API after prefixed EME API.</p> | 12 <p>Call unprefixed EME API after prefixed 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 video.webkitGenerateKeyRequest('webkit-org.w3.clearkey'); | 21 video.webkitGenerateKeyRequest('webkit-org.w3.clearkey'); |
| 22 MediaKeys.create('org.w3.clearkey').then(function(mediaKeys) { | 22 navigator.requestMediaKeySystemAccess('org.w3.clearkey').the n(function(access) { |
| 23 assert_equals(access.keySystem, 'org.w3.clearkey'); | |
|
ddorwin
2014/10/24 23:08:14
ditto
| |
| 24 return access.createMediaKeys(); | |
| 25 }).then(function(mediaKeys) { | |
| 23 assert_not_equals(mediaKeys, null); | 26 assert_not_equals(mediaKeys, null); |
| 24 assert_equals(mediaKeys.keySystem, 'org.w3.clearkey'); | |
| 25 video.setMediaKeys(mediaKeys).then(function(result) { | 27 video.setMediaKeys(mediaKeys).then(function(result) { |
| 26 assert_unreached('setMediaKeys should have failed.') ; | 28 assert_unreached('setMediaKeys should have failed.') ; |
| 27 }, function(error) { | 29 }, function(error) { |
| 28 assert_equals(error.name, 'InvalidStateError'); | 30 assert_equals(error.name, 'InvalidStateError'); |
| 29 assert_not_equals(error.message, ''); | 31 assert_not_equals(error.message, ''); |
| 30 test.done(); | 32 test.done(); |
| 31 }); | 33 }); |
| 32 }).catch(function(error) { | 34 }).catch(function(error) { |
| 33 forceTestFailureFromPromise(test, error); | 35 forceTestFailureFromPromise(test, error); |
| 34 }); | 36 }); |
| 35 } | 37 } |
| 36 | 38 |
| 37 video.src = '../content/test-encrypted.webm'; | 39 video.src = '../content/test-encrypted.webm'; |
| 38 waitForEventAndRunStep('loadstart', video, loadStarted, test); | 40 waitForEventAndRunStep('loadstart', video, loadStarted, test); |
| 39 }, 'Call unprefixed EME API after prefixed EME API.'); | 41 }, 'Call unprefixed EME API after prefixed EME API.'); |
| 40 </script> | 42 </script> |
| 41 </body> | 43 </body> |
| 42 </html> | 44 </html> |
| OLD | NEW |