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

Side by Side Diff: LayoutTests/crypto/unwrapKey-badParameters.html

Issue 240063002: [webcrypto] Update layout tests to match idl generator changes. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 25 matching lines...) Expand all
36 error = result; 36 error = result;
37 shouldBeNull("error"); 37 shouldBeNull("error");
38 38
39 // Invalid unwrappingKey 39 // Invalid unwrappingKey
40 return crypto.subtle.unwrapKey('raw', wrappedKey, 'hi', unwrapAlgorithm, unw rappedKeyAlgorithm, extractable, keyUsages); 40 return crypto.subtle.unwrapKey('raw', wrappedKey, 'hi', unwrapAlgorithm, unw rappedKeyAlgorithm, extractable, keyUsages);
41 }).then(failAndFinishJSTest, function(result) { 41 }).then(failAndFinishJSTest, function(result) {
42 error = result; 42 error = result;
43 shouldBeNull("error"); 43 shouldBeNull("error");
44 44
45 // Invalid keyUsages (also, unwrappedKeyAlgorithm is set to null). 45 // Invalid keyUsages (also, unwrappedKeyAlgorithm is set to null).
46 shouldThrow("crypto.subtle.unwrapKey('raw', wrappedKey, 'hi', unwrapAlgorith m, null, extractable, 9)"); 46 return crypto.subtle.unwrapKey('raw', wrappedKey, 'hi', unwrapAlgorithm, nul l, extractable, 9);
47 }).then(failAndFinishJSTest, function(result) {
48 error = result;
49 shouldBeTypeError("error");
47 50
48 // Invalid unwrapAlgorithm 51 // Invalid unwrapAlgorithm
49 return crypto.subtle.unwrapKey('raw', wrappedKey, unwrappingKey, null, unwra ppedKeyAlgorithm, extractable, keyUsages); 52 return crypto.subtle.unwrapKey('raw', wrappedKey, unwrappingKey, null, unwra ppedKeyAlgorithm, extractable, keyUsages);
50 }).then(failAndFinishJSTest, function(result) { 53 }).then(failAndFinishJSTest, function(result) {
51 error = result; 54 error = result;
52 shouldBeNull("error"); 55 shouldBeNull("error");
53 56
54 // Invalid unwrappedKeyAlgorithm (specified but bad). 57 // Invalid unwrappedKeyAlgorithm (specified but bad).
55 shouldThrow("crypto.subtle.unwrapKey('raw', wrappedKey, unwrappingKey, unwra pAlgorithm, 3, extractable, keyUsages)"); 58 return crypto.subtle.unwrapKey('raw', wrappedKey, unwrappingKey, unwrapAlgor ithm, 3, extractable, keyUsages);
59 }).then(failAndFinishJSTest, function(result) {
60 error = result;
61 shouldBeTypeError("error");
56 62
57 // Invalid format 63 // Invalid format
58 return crypto.subtle.unwrapKey('bad-format', wrappedKey, unwrappingKey, unwr apAlgorithm, unwrappedKeyAlgorithm, extractable, keyUsages); 64 return crypto.subtle.unwrapKey('bad-format', wrappedKey, unwrappingKey, unwr apAlgorithm, unwrappedKeyAlgorithm, extractable, keyUsages);
59 }).then(failAndFinishJSTest, function(result) { 65 }).then(failAndFinishJSTest, function(result) {
60 error = result; 66 error = result;
61 shouldBeNull("error"); 67 shouldBeNull("error");
62 68
63 // SHA-1 isn't a valid unwrapKey algorithm. 69 // SHA-1 isn't a valid unwrapKey algorithm.
64 return crypto.subtle.unwrapKey('raw', wrappedKey, unwrappingKey, {name: 'SHA -1'}, unwrappedKeyAlgorithm, extractable, keyUsages); 70 return crypto.subtle.unwrapKey('raw', wrappedKey, unwrappingKey, {name: 'SHA -1'}, unwrappedKeyAlgorithm, extractable, keyUsages);
65 }).then(failAndFinishJSTest, function(result) { 71 }).then(failAndFinishJSTest, function(result) {
66 error = result; 72 error = result;
67 shouldBeNull("error"); 73 shouldBeNull("error");
68 74
69 // Mismatch between the unwrappingKey's algorithm and unwrapAlgorithm. 75 // Mismatch between the unwrappingKey's algorithm and unwrapAlgorithm.
70 aesCtrAlgorithm = {name: 'AES-CTR', counter: new Uint8Array(16), length: 0}; 76 aesCtrAlgorithm = {name: 'AES-CTR', counter: new Uint8Array(16), length: 0};
71 return crypto.subtle.unwrapKey('raw', wrappedKey, unwrappingKey, aesCtrAlgor ithm, unwrappedKeyAlgorithm, extractable, keyUsages); 77 return crypto.subtle.unwrapKey('raw', wrappedKey, unwrappingKey, aesCtrAlgor ithm, unwrappedKeyAlgorithm, extractable, keyUsages);
72 }).then(failAndFinishJSTest, function(result) { 78 }).then(failAndFinishJSTest, function(result) {
73 error = result; 79 error = result;
74 shouldBeNull("error"); 80 shouldBeNull("error");
75 }).then(finishJSTest, failAndFinishJSTest); 81 }).then(finishJSTest, failAndFinishJSTest);
76 82
77 </script> 83 </script>
78 84
79 </body> 85 </body>
80 </html> 86 </html>
OLDNEW
« no previous file with comments | « LayoutTests/crypto/resources/common.js ('k') | LayoutTests/crypto/unwrapKey-badParameters-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698