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

Side by Side Diff: LayoutTests/crypto/generateKey.html

Issue 23361019: WebCrypto: properly normalize optional numeric parameters. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Replace contains() with a different get() method Created 7 years, 4 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
« no previous file with comments | « no previous file | LayoutTests/crypto/generateKey-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../fast/js/resources/js-test-pre.js"></script> 4 <script src="../fast/js/resources/js-test-pre.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 21 matching lines...) Expand all
32 shouldThrow("crypto.subtle.generateKey({ name: 'aes-cbc', length: -Infinity }, e xtractable, keyUsages)"); 32 shouldThrow("crypto.subtle.generateKey({ name: 'aes-cbc', length: -Infinity }, e xtractable, keyUsages)");
33 33
34 // --------------------------------------------------- 34 // ---------------------------------------------------
35 // HMAC normalization failures (HmacKeyParams) 35 // HMAC normalization failures (HmacKeyParams)
36 // --------------------------------------------------- 36 // ---------------------------------------------------
37 37
38 shouldThrow("crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, l ength: -3}, extractable , keyUsages)"); 38 shouldThrow("crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, l ength: -3}, extractable , keyUsages)");
39 shouldThrow("crypto.subtle.generateKey({name: 'hmac', hash: {name: ''}, length: 48}, extractable , keyUsages)"); 39 shouldThrow("crypto.subtle.generateKey({name: 'hmac', hash: {name: ''}, length: 48}, extractable , keyUsages)");
40 shouldThrow("crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, l ength: 5000000000}, extractable , keyUsages)"); 40 shouldThrow("crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, l ength: 5000000000}, extractable , keyUsages)");
41 shouldThrow("crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, l ength: NaN}, extractable , keyUsages)"); 41 shouldThrow("crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, l ength: NaN}, extractable , keyUsages)");
42 shouldThrow("crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, l ength: -NaN}, extractable , keyUsages)");
43 shouldThrow("crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, l ength: Infinity}, extractable , keyUsages)"); 42 shouldThrow("crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, l ength: Infinity}, extractable , keyUsages)");
44 shouldThrow("crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, l ength: -Infinity}, extractable , keyUsages)"); 43 shouldThrow("crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, l ength: -Infinity}, extractable , keyUsages)");
44 shouldThrow("crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, l ength: crypto}, extractable , keyUsages)");
45 shouldThrow("crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, l ength: undefined}, extractable , keyUsages)");
46
47 // The length property doesn't strictly need to be a number according to WebIDL.
48 // It just has to be convertable with ToNumber().
49 shouldNotThrow("crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'} , length: '48'}, extractable , keyUsages)");
50 shouldNotThrow("crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'} , length: null}, extractable , keyUsages)");
51 shouldNotThrow("crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'} , length: true}, extractable , keyUsages)");
45 52
46 // --------------------------------------------------- 53 // ---------------------------------------------------
47 // RSASSA-PKCS1-v1_5 normalization failures (RsaKeyGenParams) 54 // RSASSA-PKCS1-v1_5 normalization failures (RsaKeyGenParams)
48 // --------------------------------------------------- 55 // ---------------------------------------------------
49 56
50 shouldThrow("crypto.subtle.generateKey({name: 'RSASSA-PKCS1-v1_5', modulusLength : -30}, extractable , keyUsages)"); 57 shouldThrow("crypto.subtle.generateKey({name: 'RSASSA-PKCS1-v1_5', modulusLength : -30}, extractable , keyUsages)");
51 shouldThrow("crypto.subtle.generateKey({name: 'RSASSA-PKCS1-v1_5', modulusLength : NaN}, extractable , keyUsages)"); 58 shouldThrow("crypto.subtle.generateKey({name: 'RSASSA-PKCS1-v1_5', modulusLength : NaN}, extractable , keyUsages)");
52 shouldThrow("crypto.subtle.generateKey({name: 'RSASSA-PKCS1-v1_5'}, extractable , keyUsages)"); 59 shouldThrow("crypto.subtle.generateKey({name: 'RSASSA-PKCS1-v1_5'}, extractable , keyUsages)");
53 shouldThrow("crypto.subtle.generateKey({name: 'RSASSA-PKCS1-v1_5', modulusLength : 10}, extractable , keyUsages)"); 60 shouldThrow("crypto.subtle.generateKey({name: 'RSASSA-PKCS1-v1_5', modulusLength : 10}, extractable , keyUsages)");
54 shouldThrow("crypto.subtle.generateKey({name: 'RSASSA-PKCS1-v1_5', modulusLength : 10, publicExponent: 10}, extractable , keyUsages)"); 61 shouldThrow("crypto.subtle.generateKey({name: 'RSASSA-PKCS1-v1_5', modulusLength : 10, publicExponent: 10}, extractable , keyUsages)");
(...skipping 28 matching lines...) Expand all
83 shouldBe("key.algorithm.hash.name", "'SHA-256'") 90 shouldBe("key.algorithm.hash.name", "'SHA-256'")
84 shouldBe("key.algorithm.length", "48") 91 shouldBe("key.algorithm.length", "48")
85 shouldBe("key.usages.join(',')", "'sign'") 92 shouldBe("key.usages.join(',')", "'sign'")
86 }).then(finishJSTest, failAndFinishJSTest); 93 }).then(finishJSTest, failAndFinishJSTest);
87 94
88 </script> 95 </script>
89 96
90 <script src="../fast/js/resources/js-test-post.js"></script> 97 <script src="../fast/js/resources/js-test-post.js"></script>
91 </body> 98 </body>
92 </html> 99 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/crypto/generateKey-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698