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

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

Issue 2154263004: [MD Settings] Lazy create dialogs in Passwords and Autofill section. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback 2.0 Created 4 years, 5 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_autofill_section_browsertest.js
diff --git a/chrome/test/data/webui/settings/settings_autofill_section_browsertest.js b/chrome/test/data/webui/settings/settings_autofill_section_browsertest.js
index ef3ba57d1963bbbc5b312b39856414e52ae31d3f..baaa82ca6c602d014cf079a4db3845dcccf96cee 100644
--- a/chrome/test/data/webui/settings/settings_autofill_section_browsertest.js
+++ b/chrome/test/data/webui/settings/settings_autofill_section_browsertest.js
@@ -164,18 +164,11 @@ SettingsAutofillSectionBrowserTest.prototype = {
createAddressDialog_: function(address) {
return new Promise(function(resolve) {
var section = document.createElement('settings-address-edit-dialog');
+ section.address = address;
document.body.appendChild(section);
- var onOpen = function() {
+ section.addEventListener('iron-overlay-opened', function() {
resolve(section);
- };
- section.addEventListener('iron-overlay-opened', onOpen);
-
- // |setTimeout| allows the dialog to async get the list of countries
- // before running any tests.
- window.setTimeout(function() {
- section.open(address); // Opening the dialog will add the item.
- Polymer.dom.flush();
- }, 0);
+ });
});
},
@@ -186,8 +179,8 @@ SettingsAutofillSectionBrowserTest.prototype = {
*/
createCreditCardDialog_: function(creditCardItem) {
var section = document.createElement('settings-credit-card-edit-dialog');
+ section.creditCard = creditCardItem;
document.body.appendChild(section);
- section.open(creditCardItem); // Opening the dialog will add the item.
Polymer.dom.flush();
return section;
},
@@ -419,13 +412,15 @@ TEST_F('SettingsAutofillSectionBrowserTest', 'AddressTests', function() {
dialog.$.phoneInput.value = phoneNumber;
dialog.$.emailInput.value = emailAddress;
- Polymer.dom.flush();
-
- assertEquals(phoneNumber, dialog.$.phoneInput.value);
- assertEquals(phoneNumber, address.phoneNumbers[0]);
+ return expectEvent(dialog, 'save-address', function() {
+ MockInteractions.tap(dialog.$.saveButton);
+ }).then(function() {
+ assertEquals(phoneNumber, dialog.$.phoneInput.value);
+ assertEquals(phoneNumber, address.phoneNumbers[0]);
- assertEquals(emailAddress, dialog.$.emailInput.value);
- assertEquals(emailAddress, address.emailAddresses[0]);
+ assertEquals(emailAddress, dialog.$.emailInput.value);
+ assertEquals(emailAddress, address.emailAddresses[0]);
+ });
});
});
@@ -435,6 +430,7 @@ TEST_F('SettingsAutofillSectionBrowserTest', 'AddressTests', function() {
var phoneNumber = '(555) 555-5555';
var emailAddress = 'no-reply@chromium.org';
+ address.countryCode = 'US'; // Set to allow save to be active.
address.phoneNumbers = [phoneNumber];
address.emailAddresses = [emailAddress];
@@ -445,10 +441,12 @@ TEST_F('SettingsAutofillSectionBrowserTest', 'AddressTests', function() {
dialog.$.phoneInput.value = '';
dialog.$.emailInput.value = '';
- Polymer.dom.flush();
-
- assertEquals(0, address.phoneNumbers.length);
- assertEquals(0, address.emailAddresses.length);
+ return expectEvent(dialog, 'save-address', function() {
+ MockInteractions.tap(dialog.$.saveButton);
+ }).then(function() {
+ assertEquals(0, address.phoneNumbers.length);
+ assertEquals(0, address.emailAddresses.length);
+ });
});
});

Powered by Google App Engine
This is Rietveld 408576698