4 <script src=
"../../resources/js-test.js"></script>
5 <script src=
"resources/common.js"></script>
8 <p id=
"description"></p>
9 <div id=
"console"></div>
12 description("Tests incorrect calls to crypto.subtle.digest()");
16 Promise
.resolve(null).then(function(result
) {
18 debug("\ndigest() without data argument...");
19 return crypto
.subtle
.digest({name
: 'sha-1'});
20 }).then(failAndFinishJSTest
, function(result
) {
23 debug("\ndigest() with data argument that is null...");
24 return crypto
.subtle
.digest({name
: 'sha-1'}, null);
25 }).then(failAndFinishJSTest
, function(result
) {
28 debug("\ndigest() with data argument that is an integer...");
29 return crypto
.subtle
.digest({name
: 'sha-1'}, 10);
30 }).then(failAndFinishJSTest
, function(result
) {
33 data
= new Uint8Array([0]);
34 debug("\ndigest() with algorithm as null...");
35 return crypto
.subtle
.digest(null, data
);
36 }).then(failAndFinishJSTest
, function(result
) {
39 debug("\ndigest() with invalid agorithm that is sha...");
40 return crypto
.subtle
.digest({name
: 'sha'}, data
);
41 }).then(failAndFinishJSTest
, function(result
) {
44 debug("\ndigest() without algorithm name...");
45 return crypto
.subtle
.digest({}, data
);
46 }).then(failAndFinishJSTest
, function(result
) {
49 }).then(finishJSTest
, failAndFinishJSTest
);