| 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 |
| 11 <script> | 11 <script> |
| 12 description("Tests generateKey() with bad AES-CBC parameters."); | 12 description("Tests generateKey() with bad AES-CBC parameters."); |
| 13 jsTestIsAsync = true; | 13 jsTestIsAsync = true; |
| 14 | 14 |
| 15 extractable = true; | 15 extractable = true; |
| 16 keyUsages = ['encrypt', 'decrypt']; | 16 keyUsages = ['encrypt', 'decrypt']; |
| 17 | 17 |
| 18 // Invalid keyUsages | 18 Promise.resolve(null).then(function() { |
| 19 shouldThrow("crypto.subtle.generateKey({ name: 'aes-cbc', length: 1024 }, extrac
table, -1)"); | 19 // Invalid keyUsages |
| 20 shouldThrow("crypto.subtle.generateKey({ name: 'aes-cbc', length: 1024 }, extrac
table, null)"); | 20 return crypto.subtle.generateKey({ name: 'aes-cbc', length: 1024 }, extracta
ble, -1); |
| 21 }).then(failAndFinishJSTest, function(result) { |
| 22 error = result |
| 23 shouldBeTypeError("error"); |
| 21 | 24 |
| 22 Promise.resolve(null).then(function() { | 25 // Invalid keyUsages |
| 26 return crypto.subtle.generateKey({ name: 'aes-cbc', length: 1024 }, extracta
ble, null); |
| 27 }).then(failAndFinishJSTest, function(result) { |
| 28 error = result |
| 29 shouldBeTypeError("error"); |
| 30 |
| 23 // Bad key usage "boo". | 31 // Bad key usage "boo". |
| 24 return crypto.subtle.generateKey({ name: 'aes-cbc', length: 1024 }, extracta
ble, ['boo']); | 32 return crypto.subtle.generateKey({ name: 'aes-cbc', length: 1024 }, extracta
ble, ['boo']); |
| 25 }).then(failAndFinishJSTest, function(result) { | 33 }).then(failAndFinishJSTest, function(result) { |
| 26 error = result; | 34 error = result; |
| 27 shouldBeNull("error"); | 35 shouldBeNull("error"); |
| 28 | 36 |
| 29 return crypto.subtle.generateKey({ name: 'aes-cbc' }, extractable, keyUsages
); | 37 return crypto.subtle.generateKey({ name: 'aes-cbc' }, extractable, keyUsages
); |
| 30 }).then(failAndFinishJSTest, function(result) { | 38 }).then(failAndFinishJSTest, function(result) { |
| 31 error = result; | 39 error = result; |
| 32 shouldBeNull("error"); | 40 shouldBeNull("error"); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 44 return crypto.subtle.generateKey({ name: 'aes-cbc', length: -Infinity }, ext
ractable, keyUsages); | 52 return crypto.subtle.generateKey({ name: 'aes-cbc', length: -Infinity }, ext
ractable, keyUsages); |
| 45 }).then(failAndFinishJSTest, function(result) { | 53 }).then(failAndFinishJSTest, function(result) { |
| 46 error = result; | 54 error = result; |
| 47 shouldBeNull("error"); | 55 shouldBeNull("error"); |
| 48 }).then(finishJSTest, failAndFinishJSTest); | 56 }).then(finishJSTest, failAndFinishJSTest); |
| 49 | 57 |
| 50 </script> | 58 </script> |
| 51 | 59 |
| 52 </body> | 60 </body> |
| 53 </html> | 61 </html> |
| OLD | NEW |