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 4443d97a155c6b4e2281d2d112e25af29553c331..be207f10763f0d79b0c96db3085dc005c3ca6c5b 100644 |
--- a/chrome/test/data/webui/settings/settings_passwords_section_browsertest.js |
+++ b/chrome/test/data/webui/settings/settings_passwords_section_browsertest.js |
@@ -106,10 +106,14 @@ SettingsPasswordSectionBrowserTest.prototype = { |
* @private |
*/ |
createPasswordsSection_: function(passwordList, exceptionList) { |
+ // Override the PasswordManagerImpl for testing. |
+ this.passwordManager = new TestPasswordManager(); |
+ this.passwordManager.data.passwords = passwordList; |
+ this.passwordManager.data.exceptions = exceptionList; |
+ PasswordManagerImpl.instance_ = this.passwordManager; |
+ |
// Create a passwords-section to use for testing. |
var passwordsSection = document.createElement('passwords-section'); |
- passwordsSection.savedPasswords = passwordList; |
- passwordsSection.passwordExceptions = exceptionList; |
document.body.appendChild(passwordsSection); |
this.flushPasswordSection_(passwordsSection); |
return passwordsSection; |
@@ -247,17 +251,12 @@ TEST_F('SettingsPasswordSectionBrowserTest', 'uiTests', function() { |
assert(firstNode); |
var firstPassword = passwordList[0]; |
- // Listen for the remove event. If this event isn't received, the test |
- // will time out and fail. |
- passwordsSection.addEventListener('remove-saved-password', |
- function(event) { |
+ self.passwordManager.removeSavedPassword = function(detail) { |
Dan Beam
2017/01/26 19:10:45
wait, what is this doing? redefining a part of a
hcarmona
2017/01/26 21:34:47
Yes. That's weird. Updated.
|
// Verify that the event matches the expected value. |
- assertEquals(firstPassword.loginPair.originUrl, |
- event.detail.originUrl); |
- assertEquals(firstPassword.loginPair.username, |
- event.detail.username); |
+ assertEquals(firstPassword.loginPair.originUrl, detail.originUrl); |
+ assertEquals(firstPassword.loginPair.username, detail.username); |
done(); |
- }); |
+ }; |
// Click the remove button on the first password. |
MockInteractions.tap(firstNode.querySelector('#passwordMenu')); |
@@ -397,19 +396,16 @@ TEST_F('SettingsPasswordSectionBrowserTest', 'uiTests', function() { |
exceptions[index].querySelector('#removeExceptionButton')); |
}; |
- // Listen for the remove event. If this event isn't received, the test |
- // will time out and fail. |
- passwordsSection.addEventListener('remove-password-exception', |
- function(event) { |
+ self.passwordManager.removeException = function(detail) { |
// Verify that the event matches the expected value. |
assertTrue(index < exceptionList.length); |
- assertEquals(exceptionList[index].exceptionUrl, event.detail); |
+ assertEquals(exceptionList[index].exceptionUrl, detail); |
if (++index < exceptionList.length) |
clickRemoveButton(); // Click 'remove' on all passwords, one by one. |
else |
done(); |
- }); |
+ }; |
// Start removing. |
clickRemoveButton(); |