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

Side by Side Diff: LayoutTests/crypto/ecdh-deriveBits-failures.html

Issue 801793003: Improve LayoutTest output for Errors (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
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 21 matching lines...) Expand all
32 keyPairs.ecdh.p384_1 = result; 32 keyPairs.ecdh.p384_1 = result;
33 33
34 return crypto.subtle.generateKey({name: "ecdsa", namedCurve: "P-256"}, tru e, ["sign"]); 34 return crypto.subtle.generateKey({name: "ecdsa", namedCurve: "P-256"}, tru e, ["sign"]);
35 }).then(function(result) { 35 }).then(function(result) {
36 keyPairs.ecdsa.p256_1 = result; 36 keyPairs.ecdsa.p256_1 = result;
37 }); 37 });
38 } 38 }
39 39
40 createTestKeys().then(function(result) { 40 createTestKeys().then(function(result) {
41 // Bad algorithm parameter (no algorithm name or public key) 41 // Bad algorithm parameter (no algorithm name or public key)
42 debug("\nderiveBits() without algorithm name or public key...");
42 return crypto.subtle.deriveBits({}, keyPairs.ecdh.p256_1.privateKey, 256); 43 return crypto.subtle.deriveBits({}, keyPairs.ecdh.p256_1.privateKey, 256);
43 }).then(failAndFinishJSTest, function(result) { 44 }).then(failAndFinishJSTest, function(result) {
44 logError(result); 45 logError(result);
45 46
46 // Bad algorithm parameter (no public key) 47 // Bad algorithm parameter (no public key)
48 debug("\nderiveBits() without public key...");
47 return crypto.subtle.deriveBits({name: 'ecdh'}, keyPairs.ecdh.p256_1.privateKe y, 256); 49 return crypto.subtle.deriveBits({name: 'ecdh'}, keyPairs.ecdh.p256_1.privateKe y, 256);
48 }).then(failAndFinishJSTest, function(result) { 50 }).then(failAndFinishJSTest, function(result) {
49 logError(result); 51 logError(result);
50 52
51 // Bad algorithm parameter (null) 53 // Bad algorithm parameter (null)
54 debug("\nderiveBits() with algorithm name that is null...");
eroman 2014/12/12 19:37:02 "with algorithm that is null" (the name would be
Paritosh Kumar 2014/12/15 08:21:27 Done.
52 return crypto.subtle.deriveBits(null, keyPairs.ecdh.p256_1.privateKey, 256); 55 return crypto.subtle.deriveBits(null, keyPairs.ecdh.p256_1.privateKey, 256);
53 }).then(failAndFinishJSTest, function(result) { 56 }).then(failAndFinishJSTest, function(result) {
54 logError(result); 57 logError(result);
55 58
56 // Bad algorithm parameter (not an object) 59 // Bad algorithm parameter (not an object)
60 debug("\nderiveBits() with algorithm name that is -1...");
eroman 2014/12/12 19:37:02 replace "algorithm name" --> "algorithm"
Paritosh Kumar 2014/12/15 08:21:27 Done.
57 return crypto.subtle.deriveBits(-1, keyPairs.ecdh.p256_1.privateKey, 256); 61 return crypto.subtle.deriveBits(-1, keyPairs.ecdh.p256_1.privateKey, 256);
58 }).then(failAndFinishJSTest, function(result) { 62 }).then(failAndFinishJSTest, function(result) {
59 logError(result); 63 logError(result);
60 64
61 // Bad algorithm parameter (public key is null) 65 // Bad algorithm parameter (public key is null)
66 debug("\nderiveBits() with public key that is null...");
62 return crypto.subtle.deriveBits({name: 'ecdh', public: null}, keyPairs.ecdh.p2 56_1.privateKey, 256); 67 return crypto.subtle.deriveBits({name: 'ecdh', public: null}, keyPairs.ecdh.p2 56_1.privateKey, 256);
63 }).then(failAndFinishJSTest, function(result) { 68 }).then(failAndFinishJSTest, function(result) {
64 logError(result); 69 logError(result);
65 70
66 // Bad algorithm parameter (public key is wrong type) 71 // Bad algorithm parameter (public key is wrong type)
72 debug("\nderiveBits() with public key that is -1...");
67 return crypto.subtle.deriveBits({name: 'ecdh', public: -1}, keyPairs.ecdh.p256 _1.privateKey, 256); 73 return crypto.subtle.deriveBits({name: 'ecdh', public: -1}, keyPairs.ecdh.p256 _1.privateKey, 256);
68 }).then(failAndFinishJSTest, function(result) { 74 }).then(failAndFinishJSTest, function(result) {
69 logError(result); 75 logError(result);
70 76
71 // Bad algorithm parameter (public key is wrong type) 77 // Bad algorithm parameter (public key is wrong type)
78 debug("\nderiveBits() with public key that is a string...");
72 return crypto.subtle.deriveBits({name: 'ecdh', public: "foo"}, keyPairs.ecdh.p 256_1.privateKey, 256); 79 return crypto.subtle.deriveBits({name: 'ecdh', public: "foo"}, keyPairs.ecdh.p 256_1.privateKey, 256);
73 }).then(failAndFinishJSTest, function(result) { 80 }).then(failAndFinishJSTest, function(result) {
74 logError(result); 81 logError(result);
75 82
76 // Bad algorithm parameter (public key is for wrong curve) 83 // Bad algorithm parameter (public key is for wrong curve)
84 debug("\nderiveBits() with wrong curve public key...");
77 return crypto.subtle.deriveBits({name: 'ecdh', public: keyPairs.ecdh.p384_1.pu blicKey}, keyPairs.ecdh.p256_1.privateKey, 256); 85 return crypto.subtle.deriveBits({name: 'ecdh', public: keyPairs.ecdh.p384_1.pu blicKey}, keyPairs.ecdh.p256_1.privateKey, 256);
78 }).then(failAndFinishJSTest, function(result) { 86 }).then(failAndFinishJSTest, function(result) {
79 logError(result); 87 logError(result);
80 88
81 // Bad algorithm parameter (public key is not a public key) 89 // Bad algorithm parameter (public key is not a public key)
90 debug("\nderiveBits() with private key as public key...");
eroman 2014/12/12 19:37:02 This is a bit hard to read. How about: deriveBits
82 return crypto.subtle.deriveBits({name: 'ecdh', public: keyPairs.ecdh.p256_2.pr ivateKey}, keyPairs.ecdh.p256_1.privateKey, 256); 91 return crypto.subtle.deriveBits({name: 'ecdh', public: keyPairs.ecdh.p256_2.pr ivateKey}, keyPairs.ecdh.p256_1.privateKey, 256);
83 }).then(failAndFinishJSTest, function(result) { 92 }).then(failAndFinishJSTest, function(result) {
84 logError(result); 93 logError(result);
85 94
86 // Bad algorithm parameter (public key is for ECDSA). 95 // Bad algorithm parameter (public key is for ECDSA).
96 debug("\nderiveBits() with public key that is for ECDSA...");
87 return crypto.subtle.deriveBits({name: 'ecdh', public: keyPairs.ecdsa.p256_1.p ublicKey}, keyPairs.ecdh.p256_1.privateKey, {test: 3}); 97 return crypto.subtle.deriveBits({name: 'ecdh', public: keyPairs.ecdsa.p256_1.p ublicKey}, keyPairs.ecdh.p256_1.privateKey, {test: 3});
88 }).then(failAndFinishJSTest, function(result) { 98 }).then(failAndFinishJSTest, function(result) {
89 logError(result); 99 logError(result);
90 }).then(finishJSTest, failAndFinishJSTest); 100 }).then(finishJSTest, failAndFinishJSTest);
91 101
92 </script> 102 </script>
93 103
94 </body> 104 </body>
95 </html> 105 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698