Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Unified Diff: LayoutTests/crypto/digest-failures.html

Issue 222003006: [webcrypto] Don't throw any extra WebIDL exceptions from WebCrypto methods. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/crypto/digest-failures-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | LayoutTests/crypto/digest-failures-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698