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

Unified Diff: chrome/test/data/webui/settings/settings_passwords_section_browsertest.js

Issue 1591053002: Add a password handler to get the list of passwords in md-settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback Created 4 years, 11 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: chrome/test/data/webui/settings/settings_passwords_section_browsertest.js
diff --git a/chrome/test/data/webui/settings/settings_passwords_section_browsertest.js b/chrome/test/data/webui/settings/settings_passwords_section_browsertest.js
index c6467b22fbc5e9f5721db8d886803ffce7f848a1..69cc4744e31bf732bb86696a83ca931db0ce741c 100644
--- a/chrome/test/data/webui/settings/settings_passwords_section_browsertest.js
+++ b/chrome/test/data/webui/settings/settings_passwords_section_browsertest.js
@@ -39,13 +39,13 @@ TEST_F('SettingsPasswordSectionBrowserTest', 'uiTests', function() {
assertEquals(self.browsePreload, document.location.href,
'Unexpected URL loaded');
- var passwordList = [{origin: 'anotherwebsite.com',
+ var passwordList = [{shownUrl: 'anotherwebsite.com',
username: 'luigi',
password: '*******'},
- {origin: 'longwebsite.com',
+ {shownUrl: 'longwebsite.com',
username: 'peach',
password: '***'},
- {origin: 'website.com',
+ {shownUrl: 'website.com',
username: 'mario',
password: '*******'}];
@@ -62,20 +62,30 @@ TEST_F('SettingsPasswordSectionBrowserTest', 'uiTests', function() {
'Failed to pass list of passwords to iron-list');
var list = Polymer.dom(passwordsSection.$.passwordList);
- assertTrue(!!list, "Failed to get the password list");
+ assertTrue(!!list, 'Failed to get the password list');
// Skip the first child because it's the template.
var listChildren = list.children.slice(1);
+ /**
+ * Helper method that validates a node matches the data for an index.
+ * @param {Array<Element>} nodes The nodes that will be checked.
+ * @param {Array<Object>} passwordList The expected data.
+ * @param {number} index The index that should match the node and data.
+ */
var validate = function(nodes, passwordList, index) {
- assertTrue(!!nodes[index], 'Failed to get nodes[' + index + ']');
- assertEquals(passwordList[index].origin,
- nodes[index].querySelector('#origin').textContent,
- 'origin mismatch in nodes[' + index + ']');
- assertEquals(passwordList[index].username,
- nodes[index].querySelector('#username').textContent,
+ var node = nodes[index];
+ var passwordInfo = passwordList[index];
+ assertTrue(!!node, 'Failed to get nodes[' + index + ']');
+ assertTrue(!!passwordInfo,
+ 'Failed to get passwordList[' + index + ']');
+ assertEquals(passwordInfo.shownUrl,
+ node.querySelector('#shownUrl').textContent,
+ 'shownUrl mismatch in nodes[' + index + ']');
+ assertEquals(passwordInfo.username,
+ node.querySelector('#username').textContent,
'username mismatch in nodes[' + index + ']');
- assertEquals(passwordList[index].password,
- nodes[index].querySelector('#password').textContent,
+ assertEquals(passwordInfo.password,
+ node.querySelector('#password').value,
'password mismatch in nodes[' + index + ']');
};
« chrome/browser/ui/webui/settings/passwords_handler.cc ('K') | « chrome/chrome_browser_ui.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698