Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / crypto / subtle / sign-verify-badParameters.html
blob579fa141e80344e37f7c669865624c84240a7788
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>
11 <script>
12 description("Tests calling cypto.subtle.sign and crypto.subtle.verify with incorrect inputs");
14 jsTestIsAsync = true;
16 function importHmacKey()
18 var importAlgorithm = {name: 'HMAC', hash: {name: 'sha-1'}};
19 var keyData = new Uint8Array(16);
20 var extractable = true;
21 var usages = ['sign', 'verify'];
23 return crypto.subtle.importKey('raw', keyData, importAlgorithm, extractable, usages);
26 data = asciiToUint8Array("hello");
27 hmac = {name: 'HMAC', hash: {name: 'sha-1'}};
29 importHmacKey().then(function(result) {
30 key = result;
32 // Pass invalid signature parameters to verify()
33 return crypto.subtle.verify(hmac, key, null, data);
34 }).then(failAndFinishJSTest, function(result) {
35 logError(result);
37 // Pass invalid signature parameters to verify()
38 return crypto.subtle.verify(hmac, key, 'a', data);
39 }).then(failAndFinishJSTest, function(result) {
40 logError(result);
42 // Pass invalid signature parameters to verify()
43 return crypto.subtle.verify(hmac, key, [], data);
44 }).then(failAndFinishJSTest, function(result) {
45 logError(result);
47 // Operation does not support signing.
48 return crypto.subtle.sign({name: 'sha-1'}, key, data);
49 }).then(failAndFinishJSTest, function(result) {
50 logError(result);
52 // Operation doesn't support signing (also given an invalid key, but the
53 // first failure takes priority)
54 return crypto.subtle.sign({name: 'AES-CBC'}, key, data);
55 }).then(failAndFinishJSTest, function(result) {
56 logError(result);
57 }).then(finishJSTest, failAndFinishJSTest);
59 </script>
61 </body>
62 </html>