OLD | NEW |
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 |
11 <script> | 11 <script> |
12 description("Tests incorrect calls to crypto.subtle.digest()"); | 12 description("Tests incorrect calls to crypto.subtle.digest()"); |
13 | 13 |
14 jsTestIsAsync = true; | 14 jsTestIsAsync = true; |
15 | 15 |
16 // Called with too few parameters. | 16 Promise.resolve(null).then(function(result) { |
17 shouldThrow("crypto.subtle.digest({name: 'sha-1'})"); | 17 // Called with too few parameters. |
| 18 return crypto.subtle.digest({name: 'sha-1'}); |
| 19 }).then(failAndFinishJSTest, function(result) { |
| 20 error = result; |
| 21 shouldBeTypeError("error"); |
18 | 22 |
19 Promise.resolve(null).then(function(result) { | |
20 // "null" is not a valid data argument. | 23 // "null" is not a valid data argument. |
21 return crypto.subtle.digest({name: 'sha-1'}, null); | 24 return crypto.subtle.digest({name: 'sha-1'}, null); |
22 }).then(failAndFinishJSTest, function(result) { | 25 }).then(failAndFinishJSTest, function(result) { |
23 error = result; | 26 error = result; |
24 shouldBeNull("error"); | 27 shouldBeNull("error"); |
25 | 28 |
26 // 10 is not a valid data argument. | 29 // 10 is not a valid data argument. |
27 return crypto.subtle.digest({name: 'sha-1'}, 10); | 30 return crypto.subtle.digest({name: 'sha-1'}, 10); |
28 }).then(failAndFinishJSTest, function(result) { | 31 }).then(failAndFinishJSTest, function(result) { |
29 error = result; | 32 error = result; |
(...skipping 17 matching lines...) Expand all Loading... |
47 }).then(failAndFinishJSTest, function(result) { | 50 }).then(failAndFinishJSTest, function(result) { |
48 error = result; | 51 error = result; |
49 shouldBeNull("error"); | 52 shouldBeNull("error"); |
50 | 53 |
51 }).then(finishJSTest, failAndFinishJSTest); | 54 }).then(finishJSTest, failAndFinishJSTest); |
52 | 55 |
53 </script> | 56 </script> |
54 | 57 |
55 </body> | 58 </body> |
56 </html> | 59 </html> |
OLD | NEW |