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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-basics.html

Issue 1745963002: CREDENTIAL: Do type checks for credential constructors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
Index: third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-basics.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-basics.html b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-basics.html
index 62d7a3df811210ab71b30e4e21530764567c586f..eced29d615a7555f72d5ff6856e0246dd208d853 100644
--- a/third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-basics.html
+++ b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-basics.html
@@ -87,4 +87,25 @@ test(function() {
credential.additionalData = additionalData;
assert_equals(credential.additionalData, additionalData);
}, 'Verify the basics of "idName", "passwordName", and "additionalData"');
+
+test(function() {
+ assert_throws(new TypeError(),
+ () => { new PasswordCredential(); });
+ assert_throws(new TypeError(),
+ () => { new PasswordCredential({}); });
+ assert_throws(new TypeError(),
+ () => { new PasswordCredential({ 'id': undefined }); });
+ assert_throws(new TypeError(),
+ () => { new PasswordCredential({ 'id': '' }); });
+ assert_throws(new TypeError(),
+ () => { new PasswordCredential({ 'password': undefined }); });
+ assert_throws(new TypeError(),
+ () => { new PasswordCredential({ 'password': '' }); });
+ assert_throws(new TypeError(),
+ () => { new PasswordCredential({ 'id': undefined, 'password': undefined }); });
+ assert_throws(new TypeError(),
+ () => { new PasswordCredential({ 'id': undefined, 'password': '' }); });
+ assert_throws(new TypeError(),
+ () => { new PasswordCredential({ 'id': undefined, 'password': undefined }); });
+}, 'PasswordCredential objects require IDs and Passwords');
</script>

Powered by Google App Engine
This is Rietveld 408576698