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

Side by Side Diff: chrome/browser/ui/webui/options/autofill_options_browsertest.js

Issue 745953002: Revert of Enable a11y audit for chrome://settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Created 6 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 GEN_INCLUDE(['options_browsertest_base.js']);
6
7 /** 5 /**
8 * Returns the HTML element for the |field|. 6 * Returns the HTML element for the |field|.
9 * @param {string} field The field name for the element. 7 * @param {string} field The field name for the element.
10 * @return {HTMLElement} The HTML element. 8 * @return {HTMLElement} The HTML element.
11 */ 9 */
12 function getField(field) { 10 function getField(field) {
13 return document.querySelector( 11 return document.querySelector(
14 '#autofill-edit-address-overlay [field=' + field + ']'); 12 '#autofill-edit-address-overlay [field=' + field + ']');
15 } 13 }
16 14
17 /** 15 /**
18 * Returns the size of the |list|. 16 * Returns the size of the |list|.
19 * @param {HTMLElement} list The list to check. 17 * @param {HTMLElement} list The list to check.
20 * @return {number} The size of the list. 18 * @return {number} The size of the list.
21 */ 19 */
22 function getListSize(list) { 20 function getListSize(list) {
23 // Remove 1 for placeholder input field. 21 // Remove 1 for placeholder input field.
24 return list.items.length - 1; 22 return list.items.length - 1;
25 } 23 }
26 24
27 /** 25 /**
28 * TestFixture for autofill options WebUI testing. 26 * TestFixture for autofill options WebUI testing.
29 * @extends {testing.Test} 27 * @extends {testing.Test}
30 * @constructor 28 * @constructor
31 */ 29 */
32 function AutofillOptionsWebUITest() {} 30 function AutofillOptionsWebUITest() {}
33 31
34 AutofillOptionsWebUITest.prototype = { 32 AutofillOptionsWebUITest.prototype = {
35 __proto__: OptionsBrowsertestBase.prototype, 33 __proto__: testing.Test.prototype,
36 34
37 /** 35 /**
38 * Browse to autofill options. 36 * Browse to autofill options.
39 * @override
40 */ 37 */
41 browsePreload: 'chrome://settings-frame/autofill', 38 browsePreload: 'chrome://settings-frame/autofill',
42 }; 39 };
43 40
44 // Test opening the autofill options has correct location. 41 // Test opening the autofill options has correct location.
45 TEST_F('AutofillOptionsWebUITest', 'testOpenAutofillOptions', function() { 42 TEST_F('AutofillOptionsWebUITest', 'testOpenAutofillOptions', function() {
46 assertEquals(this.browsePreload, document.location.href); 43 assertEquals(this.browsePreload, document.location.href);
47 }); 44 });
48 45
49 /** 46 /**
50 * TestFixture for autofill edit address overlay WebUI testing. 47 * TestFixture for autofill edit address overlay WebUI testing.
51 * @extends {testing.Test} 48 * @extends {testing.Test}
52 * @constructor 49 * @constructor
53 */ 50 */
54 function AutofillEditAddressWebUITest() {} 51 function AutofillEditAddressWebUITest() {}
55 52
56 AutofillEditAddressWebUITest.prototype = { 53 AutofillEditAddressWebUITest.prototype = {
57 __proto__: OptionsBrowsertestBase.prototype, 54 __proto__: testing.Test.prototype,
58 55
59 /** @override */ 56 /** @override */
60 browsePreload: 'chrome://settings-frame/autofillEditAddress', 57 browsePreload: 'chrome://settings-frame/autofillEditAddress',
61 }; 58 };
62 59
63 TEST_F('AutofillEditAddressWebUITest', 'testInitialFormLayout', function() { 60 TEST_F('AutofillEditAddressWebUITest', 'testInitialFormLayout', function() {
64 assertEquals(this.browsePreload, document.location.href); 61 assertEquals(this.browsePreload, document.location.href);
65 62
66 assertEquals(getField('country').value, ''); 63 assertEquals(getField('country').value, '');
67 assertEquals(0, getListSize(getField('phone'))); 64 assertEquals(0, getListSize(getField('phone')));
68 assertEquals(0, getListSize(getField('email'))); 65 assertEquals(0, getListSize(getField('email')));
69 assertEquals(0, getListSize(getField('fullName'))); 66 assertEquals(0, getListSize(getField('fullName')));
70 assertEquals('', getField('city').value); 67 assertEquals('', getField('city').value);
71 68
72 testDone(); 69 testDone();
73 }); 70 });
74 71
75 TEST_F('AutofillEditAddressWebUITest', 'testLoadAddress', function() { 72 TEST_F('AutofillEditAddressWebUITest', 'testLoadAddress', function() {
76 // Disable a11y audit on Chrome OS and Mac OSX crbug.com/434502
77 if (cr.isChromeOS || cr.isMac)
78 this.disableAccessibilityChecks();
79
80 assertEquals(this.browsePreload, document.location.href); 73 assertEquals(this.browsePreload, document.location.href);
81 74
82 var testAddress = { 75 var testAddress = {
83 guid: 'GUID Value', 76 guid: 'GUID Value',
84 fullName: ['Full Name 1', 'Full Name 2'], 77 fullName: ['Full Name 1', 'Full Name 2'],
85 companyName: 'Company Name Value', 78 companyName: 'Company Name Value',
86 addrLines: 'First Line Value\nSecond Line Value', 79 addrLines: 'First Line Value\nSecond Line Value',
87 dependentLocality: 'Dependent Locality Value', 80 dependentLocality: 'Dependent Locality Value',
88 city: 'City Value', 81 city: 'City Value',
89 state: 'State Value', 82 state: 'State Value',
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // phoneList.blur(); 205 // phoneList.blur();
213 // makes the result more deterministic when the test is run by itself. 206 // makes the result more deterministic when the test is run by itself.
214 // 207 //
215 // phoneList.blur() calls cr.ui.List.handleElementBlur_, which triggers 208 // phoneList.blur() calls cr.ui.List.handleElementBlur_, which triggers
216 // InlineEditableItemList.handleListFocusChange_, which sends the 209 // InlineEditableItemList.handleListFocusChange_, which sends the
217 // 'commitedit' event. 210 // 'commitedit' event.
218 phoneList.blur(); 211 phoneList.blur();
219 phoneList.doneValidating().then(testDone); 212 phoneList.doneValidating().then(testDone);
220 }); 213 });
221 }); 214 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698