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

Unified Diff: chrome/browser/ui/webui/options/autofill_options_browsertest.js

Issue 273533003: autofill/options: address some nits I had on one of rouslan@'s CLs[1]. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: asdf Created 6 years, 7 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/browser/ui/webui/options/autofill_options_browsertest.js
diff --git a/chrome/browser/ui/webui/options/autofill_options_browsertest.js b/chrome/browser/ui/webui/options/autofill_options_browsertest.js
index 4cbd76d66488ff2d67e7ed7de6e9a52b77c9d20e..50540ad48d7c7cf257cb840eb6fefced009c1571 100644
--- a/chrome/browser/ui/webui/options/autofill_options_browsertest.js
+++ b/chrome/browser/ui/webui/options/autofill_options_browsertest.js
@@ -15,7 +15,7 @@ function getField(field) {
/**
* Returns the size of the |list|.
* @param {HTMLElement} list The list to check.
- * @return {int} The size of the list.
+ * @return {number} The size of the list.
*/
function getListSize(list) {
// Remove 1 for placeholder input field.
@@ -53,38 +53,11 @@ function AutofillEditAddressWebUITest() {}
AutofillEditAddressWebUITest.prototype = {
__proto__: testing.Test.prototype,
- /**
- * Browse to autofill edit address overlay.
- */
- browsePreload: 'chrome://settings-frame/autofillEditAddress',
-
/** @override */
- isAsync: true,
+ browsePreload: 'chrome://settings-frame/autofillEditAddress',
};
-TEST_F('AutofillEditAddressWebUITest',
- 'testAutofillPhoneValueListDoneValidating',
- function() {
- assertEquals(this.browsePreload, document.location.href);
-
- var phoneList = getField('phone');
- expectEquals(0, phoneList.validationRequests_);
- phoneList.doneValidating().then(function() {
- phoneList.focus();
- var input = phoneList.querySelector('input');
- input.focus();
- document.execCommand('insertText', false, '111-222-333');
- assertEquals('111-222-333', input.value);
- input.blur();
- phoneList.doneValidating().then(function() {
- testDone();
- });
- });
-});
-
-TEST_F('AutofillEditAddressWebUITest',
- 'testInitialFormLayout',
- function() {
+TEST_F('AutofillEditAddressWebUITest', 'testInitialFormLayout', function() {
assertEquals(this.browsePreload, document.location.href);
assertEquals(getField('country').value, '');
@@ -96,9 +69,7 @@ TEST_F('AutofillEditAddressWebUITest',
testDone();
});
-TEST_F('AutofillEditAddressWebUITest',
- 'testLoadAddress',
- function() {
+TEST_F('AutofillEditAddressWebUITest', 'testLoadAddress', function() {
assertEquals(this.browsePreload, document.location.href);
var testAddress = {
@@ -129,9 +100,9 @@ TEST_F('AutofillEditAddressWebUITest',
};
AutofillEditAddressOverlay.loadAddress(testAddress);
- assertEquals(testAddress.guid, AutofillEditAddressOverlay.getInstance().guid);
- assertEquals(testAddress.languageCode,
- AutofillEditAddressOverlay.getInstance().languageCode);
+ var overlay = AutofillEditAddressOverlay.getInstance();
+ assertEquals(testAddress.guid, overlay.guid_);
+ assertEquals(testAddress.languageCode, overlay.languageCode_);
var lists = ['fullName', 'email', 'phone'];
for (var i in lists) {
@@ -156,13 +127,9 @@ TEST_F('AutofillEditAddressWebUITest',
var country = getField('country');
assertEquals(testAddress.country, country.value);
assertTrue(country instanceof HTMLSelectElement);
-
- testDone();
});
-TEST_F('AutofillEditAddressWebUITest',
- 'testLoadAddressComponents',
- function() {
+TEST_F('AutofillEditAddressWebUITest', 'testLoadAddressComponents', function() {
assertEquals(this.browsePreload, document.location.href);
var testInput = {
@@ -172,8 +139,41 @@ TEST_F('AutofillEditAddressWebUITest',
};
AutofillEditAddressOverlay.loadAddressComponents(testInput);
- assertEquals('fr', AutofillEditAddressOverlay.getInstance().languageCode);
+ assertEquals('fr', AutofillEditAddressOverlay.getInstance().languageCode_);
expectEquals(2, $('autofill-edit-address-fields').children.length);
+});
- testDone();
+/**
+ * Class to test the autofill edit address overlay asynchronously.
+ * @extends {testing.Test}
+ * @constructor
+ */
+function AutofillEditAddressAsyncWebUITest() {}
+
+AutofillEditAddressAsyncWebUITest.prototype = {
+ __proto__: testing.Test.prototype,
+
+ /** @override */
+ browsePreload: 'chrome://settings-frame/autofillEditAddress',
+
+ /** @override */
+ isAsync: true,
+};
+
+TEST_F('AutofillEditAddressAsyncWebUITest',
+ 'testAutofillPhoneValueListDoneValidating',
+ function() {
+ assertEquals(this.browsePreload, document.location.href);
+
+ var phoneList = getField('phone');
+ expectEquals(0, phoneList.validationRequests_);
+ phoneList.doneValidating().then(function() {
+ phoneList.focus();
+ var input = phoneList.querySelector('input');
+ input.focus();
+ document.execCommand('insertText', false, '111-222-333');
+ assertEquals('111-222-333', input.value);
+ input.blur();
+ phoneList.doneValidating().then(testDone);
+ });
});

Powered by Google App Engine
This is Rietveld 408576698