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

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

Issue 1317043003: CREDENTIAL: Add 'PasswordCredential::toFormData()' (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@opaque-formdata
Patch Set: webexposed Created 5 years, 3 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: LayoutTests/http/tests/credentialmanager/passwordcredential-basics.html
diff --git a/LayoutTests/http/tests/credentialmanager/passwordcredential-basics.html b/LayoutTests/http/tests/credentialmanager/passwordcredential-basics.html
index 6b928ea49287c10d6b7713dc2555cebd58dd6bde..2085321baed8b4e9b0bd7c92ae54dd8e39e5ce06 100644
--- a/LayoutTests/http/tests/credentialmanager/passwordcredential-basics.html
+++ b/LayoutTests/http/tests/credentialmanager/passwordcredential-basics.html
@@ -8,20 +8,18 @@ test(function() {
var credential = new PasswordCredential('id', 'pencil', 'name', 'https://example.com/icon.png');
verify_interface('PasswordCredential', credential, {
- formData: 'object',
id: 'string',
name: 'string',
iconURL: 'string',
- password: 'string',
type: 'string'
});
- assert_true(credential.formData instanceof FormData);
assert_equals(credential.id, 'id');
assert_equals(credential.name, 'name');
assert_equals(credential.iconURL, 'https://example.com/icon.png');
- assert_equals(credential.password, 'pencil');
assert_equals(credential.type, 'password');
+
+ assert_true(credential.toFormData() instanceof FormData);
}, 'Interfaces and attributes of PasswordCredential');
test(function() {
@@ -36,8 +34,8 @@ test(function() {
assert_equals(credential.id, 'id');
assert_equals(credential.name, 'name');
assert_equals(credential.iconURL, '');
- assert_equals(credential.password, 'pencil');
assert_equals(credential.type, 'password');
+ assert_true(credential.toFormData() instanceof FormData);
}, 'Construct a PasswordCredential with an empty icon URL.');
@@ -47,8 +45,35 @@ test(function() {
assert_equals(credential.id, 'id');
assert_equals(credential.name, '');
assert_equals(credential.iconURL, '');
- assert_equals(credential.password, 'pencil');
assert_equals(credential.type, 'password');
-
+ assert_true(credential.toFormData() instanceof FormData);
}, 'Construct a PasswordCredential with an empty name and icon URL.');
+
+test(function() {
+ var credential = new PasswordCredential('id', 'pencil');
+
+ var fd = credential.toFormData();
+ fd.append('n1', 'v1');
+ fd.append('n2', 'v2');
+ fd.append('n3', 'v3');
+ fd.append('n1', 'v4');
+ fd.append('n2', 'v5');
+ fd.append('n3', 'v6');
+
+ assert_equals(fd.get('n1'), null);
+ assert_equals(fd.get('n2'), null);
+ assert_equals(fd.get('n3'), null);
+
+ assert_equals(fd.has('n1'), false);
+ assert_equals(fd.has('n2'), false);
+ assert_equals(fd.has('n3'), false);
+
+ assert_array_equals(fd.getAll('n1'), []);
+ assert_array_equals(fd.getAll('n2'), []);
+ assert_array_equals(fd.getAll('n3'), []);
+
+ for(var entry of fd) {
+ assert_unreached("There should be nothing to iterate here.");
+ }
+}, 'Verify properties of opaque FormData.');
</script>

Powered by Google App Engine
This is Rietveld 408576698