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

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

Issue 222003006: [webcrypto] Don't throw any extra WebIDL exceptions from WebCrypto methods. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase 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 22 matching lines...) Expand all
33 33
34 importWrappingKey().then(function(result) { 34 importWrappingKey().then(function(result) {
35 wrappingKey = result; 35 wrappingKey = result;
36 return importKeyToWrap(); 36 return importKeyToWrap();
37 }).then(function(result) { 37 }).then(function(result) {
38 key = result; 38 key = result;
39 39
40 wrapAlgorithm = {name: 'aes-cbc', iv: new Uint8Array(16)}; 40 wrapAlgorithm = {name: 'aes-cbc', iv: new Uint8Array(16)};
41 41
42 // Invalid key 42 // Invalid key
43 shouldThrow("crypto.subtle.wrapKey('raw', 1, wrappingKey, wrapAlgorithm)"); 43 return crypto.subtle.wrapKey('raw', 1, wrappingKey, wrapAlgorithm);
44 }).then(failAndFinishJSTest, function(result) {
45 error = result;
46 shouldBeNull("error");
44 47
45 // Invalid wrappingKey 48 // Invalid wrappingKey
46 shouldThrow("crypto.subtle.wrapKey('raw', key, '', wrapAlgorithm)"); 49 return crypto.subtle.wrapKey('raw', key, '', wrapAlgorithm);
50 }).then(failAndFinishJSTest, function(result) {
51 error = result;
52 shouldBeNull("error");
47 53
48 // Invalid wrapAlgorithm 54 // Invalid wrapAlgorithm
49 shouldThrow("crypto.subtle.wrapKey('raw', key, wrappingKey, undefined)"); 55 return crypto.subtle.wrapKey('raw', key, wrappingKey, undefined);
56 }).then(failAndFinishJSTest, function(result) {
57 error = result;
58 shouldBeNull("error");
50 59
51 // Invalid format for wrapKey 60 // Invalid format for wrapKey
52 return crypto.subtle.wrapKey('bad-format', key, wrappingKey, wrapAlgorithm); 61 return crypto.subtle.wrapKey('bad-format', key, wrappingKey, wrapAlgorithm);
53 }).then(failAndFinishJSTest, function(result) { 62 }).then(failAndFinishJSTest, function(result) {
54 error = result; 63 error = result;
55 shouldBeNull("error"); 64 shouldBeNull("error");
56 65
57 // SHA-1 isn't a valid wrapKey algorithm. 66 // SHA-1 isn't a valid wrapKey algorithm.
58 return crypto.subtle.wrapKey('raw', key, wrappingKey, {name: 'SHA-1'}); 67 return crypto.subtle.wrapKey('raw', key, wrappingKey, {name: 'SHA-1'});
59 }).then(failAndFinishJSTest, function(result) { 68 }).then(failAndFinishJSTest, function(result) {
60 error = result; 69 error = result;
61 shouldBeNull("error"); 70 shouldBeNull("error");
62 71
63 // Wrap algorithm doesn't match the wrapping key's algorithm (AES-CBC key 72 // Wrap algorithm doesn't match the wrapping key's algorithm (AES-CBC key
64 // with AES-CTR wrap algorithm) 73 // with AES-CTR wrap algorithm)
65 aesCtrAlgorithm = {name: 'AES-CTR', counter: new Uint8Array(16), length: 0}; 74 aesCtrAlgorithm = {name: 'AES-CTR', counter: new Uint8Array(16), length: 0};
66 return crypto.subtle.wrapKey('raw', key, wrappingKey, aesCtrAlgorithm); 75 return crypto.subtle.wrapKey('raw', key, wrappingKey, aesCtrAlgorithm);
67 }).then(failAndFinishJSTest, function(result) { 76 }).then(failAndFinishJSTest, function(result) {
68 error = result; 77 error = result;
69 shouldBeNull("error"); 78 shouldBeNull("error");
70 }).then(finishJSTest, failAndFinishJSTest); 79 }).then(finishJSTest, failAndFinishJSTest);
71 80
72 </script> 81 </script>
73 82
74 </body> 83 </body>
75 </html> 84 </html>
OLDNEW
« no previous file with comments | « LayoutTests/crypto/unwrapKey-badParameters-expected.txt ('k') | LayoutTests/crypto/wrapKey-badParameters-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698