| 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 20 matching lines...) Expand all Loading... |
| 31 } | 31 } |
| 32 | 32 |
| 33 return crypto.subtle.importKey('raw', keyData, algorithm, extractable, usage
s); | 33 return crypto.subtle.importKey('raw', keyData, algorithm, extractable, usage
s); |
| 34 } | 34 } |
| 35 | 35 |
| 36 function testEncrypt() | 36 function testEncrypt() |
| 37 { | 37 { |
| 38 return importKeyExcludingUsage("encrypt").then(function(key) { | 38 return importKeyExcludingUsage("encrypt").then(function(key) { |
| 39 return crypto.subtle.encrypt({name: 'AES-CBC', iv: iv}, key, data); | 39 return crypto.subtle.encrypt({name: 'AES-CBC', iv: iv}, key, data); |
| 40 }).then(failAndFinishJSTest, function(result) { | 40 }).then(failAndFinishJSTest, function(result) { |
| 41 error = result; | 41 logError(result); |
| 42 shouldBeNull("error"); | |
| 43 }); | 42 }); |
| 44 } | 43 } |
| 45 | 44 |
| 46 function testDecrypt() | 45 function testDecrypt() |
| 47 { | 46 { |
| 48 return importKeyExcludingUsage("decrypt").then(function(key) { | 47 return importKeyExcludingUsage("decrypt").then(function(key) { |
| 49 return crypto.subtle.decrypt({name: 'AES-CBC', iv: iv}, key, data); | 48 return crypto.subtle.decrypt({name: 'AES-CBC', iv: iv}, key, data); |
| 50 }).then(failAndFinishJSTest, function(result) { | 49 }).then(failAndFinishJSTest, function(result) { |
| 51 error = result; | 50 logError(result); |
| 52 shouldBeNull("error"); | |
| 53 }); | 51 }); |
| 54 } | 52 } |
| 55 | 53 |
| 56 // FIXME: Add wrapKey() and unwrapKey() | 54 // FIXME: Add wrapKey() and unwrapKey() |
| 57 | 55 |
| 58 testEncrypt().then(testDecrypt).then(finishJSTest, failAndFinishJSTest); | 56 testEncrypt().then(testDecrypt).then(finishJSTest, failAndFinishJSTest); |
| 59 | 57 |
| 60 </script> | 58 </script> |
| 61 | 59 |
| 62 </body> | 60 </body> |
| 63 </html> | 61 </html> |
| OLD | NEW |