Index: LayoutTests/crypto/digest-failures.html |
diff --git a/LayoutTests/crypto/digest-failures.html b/LayoutTests/crypto/digest-failures.html |
index 1162e1cdc2c1743c0afa114102b8da5a1a502703..c760cd06c4801c21731b3f94134f27ad6078d320 100644 |
--- a/LayoutTests/crypto/digest-failures.html |
+++ b/LayoutTests/crypto/digest-failures.html |
@@ -13,16 +13,29 @@ description("Tests incorrect calls to crypto.subtle.digest()"); |
jsTestIsAsync = true; |
-// Pass invalid data to digest() |
+// Called with too few parameters. |
shouldThrow("crypto.subtle.digest({name: 'sha-1'})"); |
-shouldThrow("crypto.subtle.digest({name: 'sha-1'}, null)"); |
-shouldThrow("crypto.subtle.digest({name: 'sha-1'}, 10)"); |
- |
-// Pass invalid algorithmIdentifiers to digest() |
-data = new Uint8Array([0]); |
-shouldThrow("crypto.subtle.digest(null, data)"); |
Promise.resolve(null).then(function(result) { |
+ // "null" is not a valid data argument. |
+ return crypto.subtle.digest({name: 'sha-1'}, null); |
+}).then(failAndFinishJSTest, function(result) { |
+ error = result; |
+ shouldBeNull("error"); |
+ |
+ // 10 is not a valid data argument. |
+ return crypto.subtle.digest({name: 'sha-1'}, 10); |
+}).then(failAndFinishJSTest, function(result) { |
+ error = result; |
+ shouldBeNull("error"); |
+ |
+ // null is not a valid algorithm argument. |
+ data = new Uint8Array([0]); |
+ return crypto.subtle.digest(null, data); |
+}).then(failAndFinishJSTest, function(result) { |
+ error = result; |
+ shouldBeNull("error"); |
+ |
// "sha" is not a recognized algorithm name |
return crypto.subtle.digest({name: 'sha'}, data); |
}).then(failAndFinishJSTest, function(result) { |