| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Test handling of invalid initData for generateRequest().</title> | 4 <title>Test handling of invalid initData for generateRequest().</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> | |
| 11 <script> | 10 <script> |
| 12 // Create a session and call generateRequest() with |initDataType| | 11 // Create a session and call generateRequest() with |initDataType| |
| 13 // and |initData|. generateRequest() should fail with an | 12 // and |initData|. generateRequest() should fail with an |
| 14 // InvalidAccessError. Returns a promise that resolves successfully | 13 // InvalidAccessError. Returns a promise that resolves successfully |
| 15 // if the error happened, rejects otherwise. | 14 // if the error happened, rejects otherwise. |
| 16 function test_session(initDataType, initData) | 15 function test_session(initDataType, initData) |
| 17 { | 16 { |
| 18 return isInitDataTypeSupported(initDataType).then(function(resul
t) { | 17 return isInitDataTypeSupported(initDataType).then(function(resul
t) { |
| 19 // If |initDataType| is not supported, simply succeed. | 18 // If |initDataType| is not supported, simply succeed. |
| 20 if (!result) | 19 if (!result) |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 promise_test(function() | 93 promise_test(function() |
| 95 { | 94 { |
| 96 // Valid key ID size must be less than 512 characters for keyids
. | 95 // Valid key ID size must be less than 512 characters for keyids
. |
| 97 var keyId = new Uint8Array(600); | 96 var keyId = new Uint8Array(600); |
| 98 var initData = stringToUint8Array(createKeyIDs(keyId)); | 97 var initData = stringToUint8Array(createKeyIDs(keyId)); |
| 99 return test_session('keyids', initData); | 98 return test_session('keyids', initData); |
| 100 }, 'generateRequest() with too long key ID.'); | 99 }, 'generateRequest() with too long key ID.'); |
| 101 </script> | 100 </script> |
| 102 </body> | 101 </body> |
| 103 </html> | 102 </html> |
| OLD | NEW |