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

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

Issue 199663006: [refactor] Split up the layout test sign-verify.html into smaller files. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 6 years, 9 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
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../resources/js-test.js"></script>
5 <script src="resources/common.js"></script>
6 </head>
7 <body>
8 <p id="description"></p>
9 <div id="console"></div>
10
11 <script>
12 description("Tests calling cypto.subtle.sign and crypto.subtle.verify with incor rect inputs");
13
14 jsTestIsAsync = true;
15
16 function importHmacKey()
17 {
18 var importAlgorithm = {name: 'HMAC', hash: {name: 'sha-1'}};
19 var keyData = new Uint8Array(16);
20 var extractable = true;
21 var usages = ['sign', 'verify'];
22
23 return crypto.subtle.importKey('raw', keyData, importAlgorithm, extractable, usages);
24 }
25
26 data = asciiToUint8Array("hello");
27 hmac = {name: 'HMAC', hash: {name: 'sha-1'}};
28
29 importHmacKey().then(function(result) {
30 key = result;
31
32 // Pass invalid signature parameters to verify()
33 shouldThrow("crypto.subtle.verify(hmac, key, null, data)");
34 shouldThrow("crypto.subtle.verify(hmac, key, 'a', data)");
35 shouldThrow("crypto.subtle.verify(hmac, key, [], data)");
36
37 // Operation does not support signing.
38 return crypto.subtle.sign({name: 'sha-1'}, key, data);
39 }).then(failAndFinishJSTest, function(result) {
40 error = result;
41 shouldBeNull("error");
42
43 // Operation doesn't support signing (also given an invalid key, but the
44 // first failure takes priority)
45 return crypto.subtle.sign({name: 'RSAES-PKCS1-v1_5'}, key, data);
46 }).then(failAndFinishJSTest, function(result) {
47 error = result;
48 shouldBeNull("error");
49 }).then(finishJSTest, failAndFinishJSTest);
50
51 </script>
52
53 </body>
54 </html>
OLDNEW
« no previous file with comments | « LayoutTests/crypto/sign-verify.html ('k') | LayoutTests/crypto/sign-verify-badParameters-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698