OLD | NEW |
| (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 incorrect calls to crypto.subtle.digest()"); | |
13 | |
14 jsTestIsAsync = true; | |
15 | |
16 Promise.resolve(null).then(function(result) { | |
17 | |
18 debug("\ndigest() without data argument..."); | |
19 return crypto.subtle.digest({name: 'sha-1'}); | |
20 }).then(failAndFinishJSTest, function(result) { | |
21 logError(result); | |
22 | |
23 debug("\ndigest() with data argument that is null..."); | |
24 return crypto.subtle.digest({name: 'sha-1'}, null); | |
25 }).then(failAndFinishJSTest, function(result) { | |
26 logError(result); | |
27 | |
28 debug("\ndigest() with data argument that is an integer..."); | |
29 return crypto.subtle.digest({name: 'sha-1'}, 10); | |
30 }).then(failAndFinishJSTest, function(result) { | |
31 logError(result); | |
32 | |
33 data = new Uint8Array([0]); | |
34 debug("\ndigest() with algorithm as null..."); | |
35 return crypto.subtle.digest(null, data); | |
36 }).then(failAndFinishJSTest, function(result) { | |
37 logError(result); | |
38 | |
39 debug("\ndigest() with invalid agorithm that is sha..."); | |
40 return crypto.subtle.digest({name: 'sha'}, data); | |
41 }).then(failAndFinishJSTest, function(result) { | |
42 logError(result); | |
43 | |
44 debug("\ndigest() without algorithm name..."); | |
45 return crypto.subtle.digest({}, data); | |
46 }).then(failAndFinishJSTest, function(result) { | |
47 logError(result); | |
48 | |
49 }).then(finishJSTest, failAndFinishJSTest); | |
50 | |
51 </script> | |
52 | |
53 </body> | |
54 </html> | |
OLD | NEW |