Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Side by Side Diff: LayoutTests/crypto/aes-key-usages.html

Issue 243853004: [webcrypto] Reject failed operations with a DOMException rather than null. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix compile warning Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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>
OLDNEW
« no previous file with comments | « LayoutTests/crypto/aes-key-algorithm-mismatch-expected.txt ('k') | LayoutTests/crypto/aes-key-usages-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698