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

Side by Side Diff: LayoutTests/crypto/ecdh-generate-key.html

Issue 754563003: Add LayoutTests for WebCrypto's ECDH algorithm. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase onto master Created 6 years 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
11 <script> 11 <script>
12 description("Test generating an EC key pair for ECDSA."); 12 description("Test generating an EC key pair for ECDH.");
13 13
14 jsTestIsAsync = true; 14 jsTestIsAsync = true;
15 15
16 var algorithmKeyGen = { 16 var algorithmKeyGen = {
17 name: "ecdsa", 17 name: "ecdh",
18 namedCurve: "P-256", 18 namedCurve: "P-256",
19 }; 19 };
20 var extractable = true; 20 var extractable = true;
21 21
22 debug("Generating a key pair..."); 22 debug("Generating a key pair...");
23 crypto.subtle.generateKey(algorithmKeyGen, extractable, ["sign", "verify"]).then (function(result) { 23 crypto.subtle.generateKey(algorithmKeyGen, extractable, ["deriveBits"]).then(fun ction(result) {
24 keyPair = result; 24 keyPair = result;
25 shouldBe("keyPair.toString()", "'[object Object]'"); 25 shouldBe("keyPair.toString()", "'[object Object]'");
26 shouldBe("keyPair.publicKey.type", "'public'"); 26 shouldBe("keyPair.publicKey.type", "'public'");
27 shouldBe("keyPair.publicKey.algorithm.name", "'ECDSA'"); 27 shouldBe("keyPair.publicKey.algorithm.name", "'ECDH'");
28 shouldBe("keyPair.publicKey.algorithm.namedCurve", "'P-256'"); 28 shouldBe("keyPair.publicKey.algorithm.namedCurve", "'P-256'");
29 shouldBe("keyPair.publicKey.usages", '["verify"]'); 29 shouldBe("keyPair.publicKey.usages", '[]');
30 shouldBe("keyPair.privateKey.type", "'private'"); 30 shouldBe("keyPair.privateKey.type", "'private'");
31 shouldBe("keyPair.privateKey.algorithm.name", "'ECDSA'"); 31 shouldBe("keyPair.privateKey.algorithm.name", "'ECDH'");
32 shouldBe("keyPair.privateKey.algorithm.namedCurve", "'P-256'"); 32 shouldBe("keyPair.privateKey.algorithm.namedCurve", "'P-256'");
33 shouldBe("keyPair.privateKey.usages", '["sign"]'); 33 shouldBe("keyPair.privateKey.usages", '["deriveBits"]');
34 34
35 debug("\nTesting that custom attributes on keys survive garbage collection.. ."); 35 debug("\nTesting that custom attributes on keys survive garbage collection.. .");
36 keyPair.publicKey.foo = "bar"; 36 keyPair.publicKey.foo = "bar";
37 gc(); 37 gc();
38 setTimeout(function() { 38 setTimeout(function() {
39 gc(); 39 gc();
40 setTimeout(function() { 40 setTimeout(function() {
41 shouldBe("keyPair.publicKey.foo", "'bar'"); 41 shouldBe("keyPair.publicKey.foo", "'bar'");
42 finishJSTest(); 42 finishJSTest();
43 }, 0); 43 }, 0);
44 }, 0); 44 }, 0);
45 }).catch(failAndFinishJSTest); 45 }).catch(failAndFinishJSTest);
46 46
47 </script> 47 </script>
48 48
49 </body> 49 </body>
50 </html> 50 </html>
OLDNEW
« no previous file with comments | « LayoutTests/crypto/ecdh-deriveBits-failures-expected.txt ('k') | LayoutTests/crypto/ecdh-generate-key-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698