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

Side by Side Diff: LayoutTests/crypto/unwrapKey-badParameters.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 15 matching lines...) Expand all
26 wrappedKey = new Uint8Array(100); 26 wrappedKey = new Uint8Array(100);
27 unwrappingKey = result; 27 unwrappingKey = result;
28 unwrapAlgorithm = {name: 'aes-cbc', iv: new Uint8Array(16)}; 28 unwrapAlgorithm = {name: 'aes-cbc', iv: new Uint8Array(16)};
29 unwrappedKeyAlgorithm = unwrapAlgorithm; 29 unwrappedKeyAlgorithm = unwrapAlgorithm;
30 extractable = true; 30 extractable = true;
31 keyUsages = ['encrypt']; 31 keyUsages = ['encrypt'];
32 32
33 // Invalid wrappedKey 33 // Invalid wrappedKey
34 return crypto.subtle.unwrapKey('raw', null, unwrappingKey, unwrapAlgorithm, unwrappedKeyAlgorithm, extractable, keyUsages); 34 return crypto.subtle.unwrapKey('raw', null, unwrappingKey, unwrapAlgorithm, unwrappedKeyAlgorithm, extractable, keyUsages);
35 }).then(failAndFinishJSTest, function(result) { 35 }).then(failAndFinishJSTest, function(result) {
36 error = result; 36 logError(result);
37 shouldBeNull("error");
38 37
39 // Invalid unwrappingKey 38 // Invalid unwrappingKey
40 return crypto.subtle.unwrapKey('raw', wrappedKey, 'hi', unwrapAlgorithm, unw rappedKeyAlgorithm, extractable, keyUsages); 39 return crypto.subtle.unwrapKey('raw', wrappedKey, 'hi', unwrapAlgorithm, unw rappedKeyAlgorithm, extractable, keyUsages);
41 }).then(failAndFinishJSTest, function(result) { 40 }).then(failAndFinishJSTest, function(result) {
42 error = result; 41 logError(result);
43 shouldBeNull("error");
44 42
45 // Invalid keyUsages (also, unwrappedKeyAlgorithm is set to null). 43 // Invalid keyUsages (also, unwrappedKeyAlgorithm is set to null).
46 return crypto.subtle.unwrapKey('raw', wrappedKey, 'hi', unwrapAlgorithm, nul l, extractable, 9); 44 return crypto.subtle.unwrapKey('raw', wrappedKey, 'hi', unwrapAlgorithm, nul l, extractable, 9);
47 }).then(failAndFinishJSTest, function(result) { 45 }).then(failAndFinishJSTest, function(result) {
48 error = result; 46 logError(result);
49 shouldBeTypeError("error");
50 47
51 // Invalid unwrapAlgorithm 48 // Invalid unwrapAlgorithm
52 return crypto.subtle.unwrapKey('raw', wrappedKey, unwrappingKey, null, unwra ppedKeyAlgorithm, extractable, keyUsages); 49 return crypto.subtle.unwrapKey('raw', wrappedKey, unwrappingKey, null, unwra ppedKeyAlgorithm, extractable, keyUsages);
53 }).then(failAndFinishJSTest, function(result) { 50 }).then(failAndFinishJSTest, function(result) {
54 error = result; 51 logError(result);
55 shouldBeNull("error");
56 52
57 // Invalid unwrappedKeyAlgorithm (specified but bad). 53 // Invalid unwrappedKeyAlgorithm (specified but bad).
58 return crypto.subtle.unwrapKey('raw', wrappedKey, unwrappingKey, unwrapAlgor ithm, 3, extractable, keyUsages); 54 return crypto.subtle.unwrapKey('raw', wrappedKey, unwrappingKey, unwrapAlgor ithm, 3, extractable, keyUsages);
59 }).then(failAndFinishJSTest, function(result) { 55 }).then(failAndFinishJSTest, function(result) {
60 error = result; 56 logError(result);
61 shouldBeTypeError("error");
62 57
63 // Invalid format 58 // Invalid format
64 return crypto.subtle.unwrapKey('bad-format', wrappedKey, unwrappingKey, unwr apAlgorithm, unwrappedKeyAlgorithm, extractable, keyUsages); 59 return crypto.subtle.unwrapKey('bad-format', wrappedKey, unwrappingKey, unwr apAlgorithm, unwrappedKeyAlgorithm, extractable, keyUsages);
65 }).then(failAndFinishJSTest, function(result) { 60 }).then(failAndFinishJSTest, function(result) {
66 error = result; 61 logError(result);
67 shouldBeNull("error");
68 62
69 // SHA-1 isn't a valid unwrapKey algorithm. 63 // SHA-1 isn't a valid unwrapKey algorithm.
70 return crypto.subtle.unwrapKey('raw', wrappedKey, unwrappingKey, {name: 'SHA -1'}, unwrappedKeyAlgorithm, extractable, keyUsages); 64 return crypto.subtle.unwrapKey('raw', wrappedKey, unwrappingKey, {name: 'SHA -1'}, unwrappedKeyAlgorithm, extractable, keyUsages);
71 }).then(failAndFinishJSTest, function(result) { 65 }).then(failAndFinishJSTest, function(result) {
72 error = result; 66 logError(result);
73 shouldBeNull("error");
74 67
75 // Mismatch between the unwrappingKey's algorithm and unwrapAlgorithm. 68 // Mismatch between the unwrappingKey's algorithm and unwrapAlgorithm.
76 aesCtrAlgorithm = {name: 'AES-CTR', counter: new Uint8Array(16), length: 0}; 69 aesCtrAlgorithm = {name: 'AES-CTR', counter: new Uint8Array(16), length: 0};
77 return crypto.subtle.unwrapKey('raw', wrappedKey, unwrappingKey, aesCtrAlgor ithm, unwrappedKeyAlgorithm, extractable, keyUsages); 70 return crypto.subtle.unwrapKey('raw', wrappedKey, unwrappingKey, aesCtrAlgor ithm, unwrappedKeyAlgorithm, extractable, keyUsages);
78 }).then(failAndFinishJSTest, function(result) { 71 }).then(failAndFinishJSTest, function(result) {
79 error = result; 72 logError(result);
80 shouldBeNull("error");
81 }).then(finishJSTest, failAndFinishJSTest); 73 }).then(finishJSTest, failAndFinishJSTest);
82 74
83 </script> 75 </script>
84 76
85 </body> 77 </body>
86 </html> 78 </html>
OLDNEW
« no previous file with comments | « LayoutTests/crypto/sign-verify-badParameters-expected.txt ('k') | LayoutTests/crypto/unwrapKey-badParameters-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698