| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../resources/js-test.js"></script> | 4 <script src="../resources/js-test.js"></script> |
| 5 <script src="resources/common.js"></script> | 5 <script src="resources/common.js"></script> |
| 6 </head> | 6 </head> |
| 7 <body> | 7 <body> |
| 8 <p id="description"></p> | 8 <p id="description"></p> |
| 9 <div id="console"></div> | 9 <div id="console"></div> |
| 10 | 10 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 }).then(undefined, function(result) { | 84 }).then(undefined, function(result) { |
| 85 debug("rejected with " + result); | 85 debug("rejected with " + result); |
| 86 | 86 |
| 87 keyFormat = "raw"; | 87 keyFormat = "raw"; |
| 88 data = asciiToUint8Array(""); | 88 data = asciiToUint8Array(""); |
| 89 algorithm = aesCbc; | 89 algorithm = aesCbc; |
| 90 extractable = true; | 90 extractable = true; |
| 91 keyUsages = []; | 91 keyUsages = []; |
| 92 | 92 |
| 93 // Invalid format. | 93 // Invalid format. |
| 94 shouldThrow("crypto.subtle.importKey('invalid format', data, algorithm, extr
actable, keyUsages)"); | 94 shouldRejectPromiseWithNull("crypto.subtle.importKey('invalid format', data,
algorithm, extractable, keyUsages)"); |
| 95 | 95 |
| 96 // Invalid key usage. | 96 // Invalid key usage. |
| 97 shouldThrow("crypto.subtle.importKey(keyFormat, data, algorithm, extractable
, ['SIGN'])"); | 97 shouldRejectPromiseWithNull("crypto.subtle.importKey(keyFormat, data, algori
thm, extractable, ['SIGN'])"); |
| 98 | 98 |
| 99 // If both the format and key usage are bogus, should complain about the | 99 // If both the format and key usage are bogus, should complain about the |
| 100 // format first. | 100 // format first. |
| 101 shouldThrow("crypto.subtle.importKey('invalid format', data, algorithm, extr
actable, ['SIGN'])"); | 101 shouldRejectPromiseWithNull("crypto.subtle.importKey('invalid format', data,
algorithm, extractable, ['SIGN'])"); |
| 102 | 102 |
| 103 // Undefined key usage. | 103 // Undefined key usage. |
| 104 // FIXME: http://crbug.com/262383 | 104 // FIXME: http://crbug.com/262383 |
| 105 //shouldThrow("crypto.subtle.importKey(keyFormat, data, algorithm, extractab
le, undefined)"); | 105 //shouldThrow("crypto.subtle.importKey(keyFormat, data, algorithm, extractab
le, undefined)"); |
| 106 | 106 |
| 107 // Invalid data | 107 // Invalid data |
| 108 shouldThrow("crypto.subtle.importKey(keyFormat, [], algorithm, extractable,
keyUsages)"); | 108 shouldThrow("crypto.subtle.importKey(keyFormat, [], algorithm, extractable,
keyUsages)"); |
| 109 shouldThrow("crypto.subtle.importKey(keyFormat, null, algorithm, extractable
, keyUsages)"); | 109 shouldThrow("crypto.subtle.importKey(keyFormat, null, algorithm, extractable
, keyUsages)"); |
| 110 | 110 |
| 111 // Missing hash parameter for HMAC. | 111 // Missing hash parameter for HMAC. |
| 112 shouldRejectPromiseWithNull("crypto.subtle.importKey(keyFormat, data, {name:
'hmac'}, extractable, keyUsages)"); | 112 shouldRejectPromiseWithNull("crypto.subtle.importKey(keyFormat, data, {name:
'hmac'}, extractable, keyUsages)"); |
| 113 | 113 |
| 114 // SHA-1 doesn't support the importKey operation. | 114 // SHA-1 doesn't support the importKey operation. |
| 115 shouldThrow("crypto.subtle.importKey(keyFormat, data, {name: 'sha-1'}, extra
ctable, keyUsages)"); | 115 shouldRejectPromiseWithNull("crypto.subtle.importKey(keyFormat, data, {name:
'sha-1'}, extractable, keyUsages)"); |
| 116 }).then(finishJSTest, failAndFinishJSTest); | 116 }).then(finishJSTest, failAndFinishJSTest); |
| 117 | 117 |
| 118 </script> | 118 </script> |
| 119 | 119 |
| 120 </body> | 120 </body> |
| 121 </html> | 121 </html> |
| OLD | NEW |