Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / crypto / digest-failures.html
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     // Called with too few parameters.
18     return crypto.subtle.digest({name: 'sha-1'});
19 }).then(failAndFinishJSTest, function(result) {
20     logError(result);
21
22     // "null" is not a valid data argument.
23     return crypto.subtle.digest({name: 'sha-1'}, null);
24 }).then(failAndFinishJSTest, function(result) {
25     logError(result);
26
27     // 10 is not a valid data argument.
28     return crypto.subtle.digest({name: 'sha-1'}, 10);
29 }).then(failAndFinishJSTest, function(result) {
30     logError(result);
31
32     // null is not a valid algorithm argument.
33     data = new Uint8Array([0]);
34     return crypto.subtle.digest(null, data);
35 }).then(failAndFinishJSTest, function(result) {
36     logError(result);
37
38     // "sha" is not a recognized algorithm name
39     return crypto.subtle.digest({name: 'sha'}, data);
40 }).then(failAndFinishJSTest, function(result) {
41     logError(result);
42
43     // Algorithm lacks a name.
44     return crypto.subtle.digest({}, data);
45 }).then(failAndFinishJSTest, function(result) {
46     logError(result);
47   
48 }).then(finishJSTest, failAndFinishJSTest);
49
50 </script>
51
52 </body>
53 </html>