| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Invalid Clear Key License.</title> | 4 <title>Invalid Clear Key License.</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 <script> | 10 <script> |
| 11 async_test(function(test) | 11 async_test(function(test) |
| 12 { | 12 { |
| 13 var initDataType; | 13 var initDataType; |
| 14 var initData; | 14 var initData; |
| 15 var invalidLicense = new Uint8Array( | 15 var invalidLicense = new Uint8Array( |
| 16 [0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77]); | 16 [0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77]); |
| 17 | 17 |
| 18 function handleMessage(event) { | 18 function handleMessage(event) { |
| 19 event.target.update(invalidLicense).then(function(event) { | 19 event.target.update(invalidLicense).then(function(event) { |
| 20 assert_unreached('Error: update() succeeded unexpectedly
.'); | 20 assert_unreached('Error: update() succeeded unexpectedly
.'); |
| 21 test.done(); | 21 test.done(); |
| 22 }).catch(function(error) { | 22 }).catch(function(error) { |
| 23 assert_equals(error.name, 'InvalidAccessError'); | 23 assert_equals(error.name, 'TypeError'); |
| 24 test.done(); | 24 test.done(); |
| 25 }); | 25 }); |
| 26 } | 26 } |
| 27 | 27 |
| 28 navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimp
leConfiguration()).then(function(access) { | 28 navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimp
leConfiguration()).then(function(access) { |
| 29 initDataType = access.getConfiguration().initDataTypes[0]; | 29 initDataType = access.getConfiguration().initDataTypes[0]; |
| 30 initData = getInitData(initDataType); | 30 initData = getInitData(initDataType); |
| 31 return access.createMediaKeys(); | 31 return access.createMediaKeys(); |
| 32 }).then(function(mediaKeys) { | 32 }).then(function(mediaKeys) { |
| 33 var keySession = mediaKeys.createSession(); | 33 var keySession = mediaKeys.createSession(); |
| 34 keySession.addEventListener('message', handleMessage, false)
; | 34 keySession.addEventListener('message', handleMessage, false)
; |
| 35 keySession.generateRequest(initDataType, initData); | 35 keySession.generateRequest(initDataType, initData); |
| 36 }).catch(function(error) { | 36 }).catch(function(error) { |
| 37 forceTestFailureFromPromise(test, error); | 37 forceTestFailureFromPromise(test, error); |
| 38 }); | 38 }); |
| 39 }, 'Invalid Clear Key License.'); | 39 }, 'Invalid Clear Key License.'); |
| 40 </script> | 40 </script> |
| 41 </body> | 41 </body> |
| 42 </html> | 42 </html> |
| OLD | NEW |