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

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

Issue 141413003: [webcrypto] Match the error handling defined by the spec. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 11 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/resources/common.js ('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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 shouldThrow("crypto.subtle.verify(hmacSha1, keys.hmacSha1, [], data)"); 133 shouldThrow("crypto.subtle.verify(hmacSha1, keys.hmacSha1, [], data)");
134 134
135 // Operation does not support signing. 135 // Operation does not support signing.
136 shouldThrow("crypto.subtle.sign({name: 'sha-1'}, keys.hmacSha1, data)"); 136 shouldThrow("crypto.subtle.sign({name: 'sha-1'}, keys.hmacSha1, data)");
137 137
138 // Operation doesn't support signing (also given an invalid key, but the 138 // Operation doesn't support signing (also given an invalid key, but the
139 // first failure takes priority) 139 // first failure takes priority)
140 shouldThrow("crypto.subtle.sign({name: 'RSAES-PKCS1-v1_5'}, keys.hmacSha1, d ata)"); 140 shouldThrow("crypto.subtle.sign({name: 'RSAES-PKCS1-v1_5'}, keys.hmacSha1, d ata)");
141 141
142 // Key's algorithm must match. 142 // Key's algorithm must match.
143 shouldThrow("crypto.subtle.sign({name: 'hmac', hash: {name: 'sha-256'}}, key s.hmacSha1, data)"); 143 shouldRejectPromiseWithNull("crypto.subtle.sign({name: 'hmac', hash: {name: 'sha-256'}}, keys.hmacSha1, data)");
144 144
145 // --------------------------------------------------- 145 // ---------------------------------------------------
146 // HMAC normalization failures (HmacParams) 146 // HMAC normalization failures (HmacParams)
147 // --------------------------------------------------- 147 // ---------------------------------------------------
148 shouldThrow("crypto.subtle.sign({name: 'hmac'}, keys.hmacSha1, data)"); 148 shouldRejectPromiseWithNull("crypto.subtle.sign({name: 'hmac'}, keys.hmacSha 1, data)");
149 shouldThrow("crypto.subtle.sign({name: 'hmac', hash: 3}, keys.hmacSha1, data )"); 149 shouldRejectPromiseWithNull("crypto.subtle.sign({name: 'hmac', hash: 3}, key s.hmacSha1, data)");
150 shouldThrow("crypto.subtle.sign({name: 'hmac', hash: null}, keys.hmacSha1, d ata)"); 150 shouldRejectPromiseWithNull("crypto.subtle.sign({name: 'hmac', hash: null}, keys.hmacSha1, data)");
151 shouldThrow("crypto.subtle.sign({name: 'hmac', hash: {}}, keys.hmacSha1, dat a)"); 151 shouldRejectPromiseWithNull("crypto.subtle.sign({name: 'hmac', hash: {}}, ke ys.hmacSha1, data)");
152 shouldThrow("crypto.subtle.sign({name: 'hmac', hash: {name: 'foo'}}, keys.hm acSha1, data)"); 152 shouldRejectPromiseWithNull("crypto.subtle.sign({name: 'hmac', hash: {name: 'foo'}}, keys.hmacSha1, data)");
153 shouldThrow("crypto.subtle.sign({name: 'hmac', hash: {name: 'AES-CBC'}}, key s.hmacSha1, data)"); 153 shouldRejectPromiseWithNull("crypto.subtle.sign({name: 'hmac', hash: {name: 'AES-CBC'}}, keys.hmacSha1, data)");
154 })); 154 }));
155 155
156 // ------------------------------------------------- 156 // -------------------------------------------------
157 // Wait until all the tests have been run. 157 // Wait until all the tests have been run.
158 // ------------------------------------------------- 158 // -------------------------------------------------
159 159
160 Promise.all(allTests).then(finishJSTest, failAndFinishJSTest); 160 Promise.all(allTests).then(finishJSTest, failAndFinishJSTest);
161 161
162 </script> 162 </script>
163 163
164 </body> 164 </body>
OLDNEW
« no previous file with comments | « LayoutTests/crypto/resources/common.js ('k') | LayoutTests/crypto/sign-verify-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698