Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / crypto / subtle / importKey-badParameters.html
blob9052c100a9a744e5b9b912a1824d835dc3222391
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.importKey with bad parameters");
14 jsTestIsAsync = true;
16 var aesCbc = {name: 'aes-cbc'};
17 var aesKeyBytes = new Uint8Array(16);
18 var extractable = true;
20 // Undefined key usage.
21 // FIXME: http://crbug.com/262383
22 //shouldThrow("crypto.subtle.importKey('raw', aesKeyBytes, aesCbc, extractable, undefined)");
24 Promise.resolve(null).then(function() {
25 // Invalid data
26 return crypto.subtle.importKey('raw', [], aesCbc, extractable, ['encrypt']);
27 }).then(failAndFinishJSTest, function(result) {
28 logError(result);
30 // 'null' treated as a Dictionary with default values - an empty dictionary
31 return crypto.subtle.importKey('raw', null, aesCbc, extractable, ['encrypt']);
32 }).then(failAndFinishJSTest, function(result) {
33 logError(result);
35 // Invalid algorithm
36 return crypto.subtle.importKey('raw', aesKeyBytes, null, extractable, ['encrypt']);
37 }).then(failAndFinishJSTest, function(result) {
38 logError(result);
40 // Invalid format.
41 return crypto.subtle.importKey('invalid format', aesKeyBytes, aesCbc, extractable, ['encrypt']);
42 }).then(failAndFinishJSTest, function(result) {
43 logError(result);
45 // Invalid key usage (case sensitive).
46 return crypto.subtle.importKey('raw', aesKeyBytes, aesCbc, extractable, ['ENCRYPT']);
47 }).then(failAndFinishJSTest, function(result) {
48 logError(result);
50 // If both the format and key usage are bogus, should complain about the
51 // format first.
52 return crypto.subtle.importKey('invalid format', aesKeyBytes, aesCbc, extractable, ['ENCRYPT']);
53 }).then(failAndFinishJSTest, function(result) {
54 logError(result);
56 // Missing hash parameter for HMAC.
57 return crypto.subtle.importKey('raw', new Uint8Array(20), {name: 'hmac'}, extractable, ['sign']);
58 }).then(failAndFinishJSTest, function(result) {
59 logError(result);
61 // SHA-1 doesn't support the importKey operation.
62 return crypto.subtle.importKey('raw', new Uint8Array(20), {name: 'sha-1'}, extractable, ['sign']);
63 }).then(failAndFinishJSTest, function(result) {
64 logError(result);
65 }).then(finishJSTest, failAndFinishJSTest);
67 </script>
69 </body>
70 </html>