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

Side by Side Diff: LayoutTests/crypto/sign-verify.html

Issue 170243007: [webcrypto] Make all of the crypto.subtle method failures asynchronous. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 | « LayoutTests/crypto/importKey-expected.txt ('k') | LayoutTests/crypto/sign-verify-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="../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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 allTests.push(importTestKeys().then(function(importedKeys) { 125 allTests.push(importTestKeys().then(function(importedKeys) {
126 keys = importedKeys; 126 keys = importedKeys;
127 127
128 // Pass invalid signature parameters to verify() 128 // Pass invalid signature parameters to verify()
129 shouldThrow("crypto.subtle.verify(hmacSha1, keys.hmacSha1, null, data)"); 129 shouldThrow("crypto.subtle.verify(hmacSha1, keys.hmacSha1, null, data)");
130 shouldThrow("crypto.subtle.verify(hmacSha1, keys.hmacSha1, 'a', data)"); 130 shouldThrow("crypto.subtle.verify(hmacSha1, keys.hmacSha1, 'a', data)");
131 shouldThrow("crypto.subtle.verify(hmacSha1, keys.hmacSha1, [], data)"); 131 shouldThrow("crypto.subtle.verify(hmacSha1, keys.hmacSha1, [], data)");
132 132
133 // Operation does not support signing. 133 // Operation does not support signing.
134 shouldThrow("crypto.subtle.sign({name: 'sha-1'}, keys.hmacSha1, data)"); 134 shouldRejectPromiseWithNull("crypto.subtle.sign({name: 'sha-1'}, keys.hmacSh a1, data)");
135 135
136 // Operation doesn't support signing (also given an invalid key, but the 136 // Operation doesn't support signing (also given an invalid key, but the
137 // first failure takes priority) 137 // first failure takes priority)
138 shouldThrow("crypto.subtle.sign({name: 'RSAES-PKCS1-v1_5'}, keys.hmacSha1, d ata)"); 138 shouldRejectPromiseWithNull("crypto.subtle.sign({name: 'RSAES-PKCS1-v1_5'}, keys.hmacSha1, data)");
139 139
140 // Key's algorithm must match. 140 // Key's algorithm must match.
141 shouldRejectPromiseWithNull("crypto.subtle.sign({name: 'hmac', hash: {name: 'sha-256'}}, keys.hmacSha1, data)"); 141 shouldRejectPromiseWithNull("crypto.subtle.sign({name: 'hmac', hash: {name: 'sha-256'}}, keys.hmacSha1, data)");
142 142
143 // --------------------------------------------------- 143 // ---------------------------------------------------
144 // HMAC normalization failures (HmacParams) 144 // HMAC normalization failures (HmacParams)
145 // --------------------------------------------------- 145 // ---------------------------------------------------
146 shouldRejectPromiseWithNull("crypto.subtle.sign({name: 'hmac'}, keys.hmacSha 1, data)"); 146 shouldRejectPromiseWithNull("crypto.subtle.sign({name: 'hmac'}, keys.hmacSha 1, data)");
147 shouldRejectPromiseWithNull("crypto.subtle.sign({name: 'hmac', hash: 3}, key s.hmacSha1, data)"); 147 shouldRejectPromiseWithNull("crypto.subtle.sign({name: 'hmac', hash: 3}, key s.hmacSha1, data)");
148 shouldRejectPromiseWithNull("crypto.subtle.sign({name: 'hmac', hash: null}, keys.hmacSha1, data)"); 148 shouldRejectPromiseWithNull("crypto.subtle.sign({name: 'hmac', hash: null}, keys.hmacSha1, data)");
149 shouldRejectPromiseWithNull("crypto.subtle.sign({name: 'hmac', hash: {}}, ke ys.hmacSha1, data)"); 149 shouldRejectPromiseWithNull("crypto.subtle.sign({name: 'hmac', hash: {}}, ke ys.hmacSha1, data)");
150 shouldRejectPromiseWithNull("crypto.subtle.sign({name: 'hmac', hash: {name: 'foo'}}, keys.hmacSha1, data)"); 150 shouldRejectPromiseWithNull("crypto.subtle.sign({name: 'hmac', hash: {name: 'foo'}}, keys.hmacSha1, data)");
151 shouldRejectPromiseWithNull("crypto.subtle.sign({name: 'hmac', hash: {name: 'AES-CBC'}}, keys.hmacSha1, data)"); 151 shouldRejectPromiseWithNull("crypto.subtle.sign({name: 'hmac', hash: {name: 'AES-CBC'}}, keys.hmacSha1, data)");
152 })); 152 }));
153 153
154 // ------------------------------------------------- 154 // -------------------------------------------------
155 // Wait until all the tests have been run. 155 // Wait until all the tests have been run.
156 // ------------------------------------------------- 156 // -------------------------------------------------
157 157
158 Promise.all(allTests).then(finishJSTest, failAndFinishJSTest); 158 Promise.all(allTests).then(finishJSTest, failAndFinishJSTest);
159 159
160 </script> 160 </script>
161 161
162 </body> 162 </body>
OLDNEW
« no previous file with comments | « LayoutTests/crypto/importKey-expected.txt ('k') | LayoutTests/crypto/sign-verify-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698