OLD | NEW |
---|---|
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 | |
5 /** | 7 /** |
6 * Returns the HTML element for the |field|. | 8 * Returns the HTML element for the |field|. |
7 * @param {string} field The field name for the element. | 9 * @param {string} field The field name for the element. |
8 * @return {HTMLElement} The HTML element. | 10 * @return {HTMLElement} The HTML element. |
9 */ | 11 */ |
10 function getField(field) { | 12 function getField(field) { |
11 return document.querySelector( | 13 return document.querySelector( |
12 '#autofill-edit-address-overlay [field=' + field + ']'); | 14 '#autofill-edit-address-overlay [field=' + field + ']'); |
13 } | 15 } |
14 | 16 |
15 /** | 17 /** |
16 * Returns the size of the |list|. | 18 * Returns the size of the |list|. |
17 * @param {HTMLElement} list The list to check. | 19 * @param {HTMLElement} list The list to check. |
18 * @return {number} The size of the list. | 20 * @return {number} The size of the list. |
19 */ | 21 */ |
20 function getListSize(list) { | 22 function getListSize(list) { |
21 // Remove 1 for placeholder input field. | 23 // Remove 1 for placeholder input field. |
22 return list.items.length - 1; | 24 return list.items.length - 1; |
23 } | 25 } |
24 | 26 |
25 /** | 27 /** |
26 * TestFixture for autofill options WebUI testing. | 28 * TestFixture for autofill options WebUI testing. |
27 * @extends {testing.Test} | 29 * @extends {testing.Test} |
28 * @constructor | 30 * @constructor |
29 */ | 31 */ |
30 function AutofillOptionsWebUITest() {} | 32 function AutofillOptionsWebUITest() {} |
31 | 33 |
32 AutofillOptionsWebUITest.prototype = { | 34 AutofillOptionsWebUITest.prototype = { |
33 __proto__: testing.Test.prototype, | 35 __proto__: OptionsBrowsertestBase.prototype, |
34 | 36 |
35 /** | 37 /** |
36 * Browse to autofill options. | 38 * Browse to autofill options. |
39 * @override | |
37 */ | 40 */ |
38 browsePreload: 'chrome://settings-frame/autofill', | 41 browsePreload: 'chrome://settings-frame/autofill', |
39 }; | 42 }; |
40 | 43 |
41 // Test opening the autofill options has correct location. | 44 // Test opening the autofill options has correct location. |
42 TEST_F('AutofillOptionsWebUITest', 'testOpenAutofillOptions', function() { | 45 TEST_F('AutofillOptionsWebUITest', 'testOpenAutofillOptions', function() { |
43 assertEquals(this.browsePreload, document.location.href); | 46 assertEquals(this.browsePreload, document.location.href); |
44 }); | 47 }); |
45 | 48 |
46 /** | 49 /** |
47 * TestFixture for autofill edit address overlay WebUI testing. | 50 * TestFixture for autofill edit address overlay WebUI testing. |
48 * @extends {testing.Test} | 51 * @extends {testing.Test} |
49 * @constructor | 52 * @constructor |
50 */ | 53 */ |
51 function AutofillEditAddressWebUITest() {} | 54 function AutofillEditAddressWebUITest() {} |
52 | 55 |
53 AutofillEditAddressWebUITest.prototype = { | 56 AutofillEditAddressWebUITest.prototype = { |
54 __proto__: testing.Test.prototype, | 57 __proto__: OptionsBrowsertestBase.prototype, |
55 | 58 |
56 /** @override */ | 59 /** @override */ |
57 browsePreload: 'chrome://settings-frame/autofillEditAddress', | 60 browsePreload: 'chrome://settings-frame/autofillEditAddress', |
58 }; | 61 }; |
59 | 62 |
60 TEST_F('AutofillEditAddressWebUITest', 'testInitialFormLayout', function() { | 63 TEST_F('AutofillEditAddressWebUITest', 'testInitialFormLayout', function() { |
61 assertEquals(this.browsePreload, document.location.href); | 64 assertEquals(this.browsePreload, document.location.href); |
62 | 65 |
63 assertEquals(getField('country').value, ''); | 66 assertEquals(getField('country').value, ''); |
64 assertEquals(0, getListSize(getField('phone'))); | 67 assertEquals(0, getListSize(getField('phone'))); |
65 assertEquals(0, getListSize(getField('email'))); | 68 assertEquals(0, getListSize(getField('email'))); |
66 assertEquals(0, getListSize(getField('fullName'))); | 69 assertEquals(0, getListSize(getField('fullName'))); |
67 assertEquals('', getField('city').value); | 70 assertEquals('', getField('city').value); |
68 | 71 |
69 testDone(); | 72 testDone(); |
70 }); | 73 }); |
71 | 74 |
72 TEST_F('AutofillEditAddressWebUITest', 'testLoadAddress', function() { | 75 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(); | |
Dan Beam
2014/11/21 05:27:57
link to why you're doing this
hcarmona
2014/12/03 00:39:00
Done.
| |
79 | |
73 assertEquals(this.browsePreload, document.location.href); | 80 assertEquals(this.browsePreload, document.location.href); |
74 | 81 |
75 var testAddress = { | 82 var testAddress = { |
76 guid: 'GUID Value', | 83 guid: 'GUID Value', |
77 fullName: ['Full Name 1', 'Full Name 2'], | 84 fullName: ['Full Name 1', 'Full Name 2'], |
78 companyName: 'Company Name Value', | 85 companyName: 'Company Name Value', |
79 addrLines: 'First Line Value\nSecond Line Value', | 86 addrLines: 'First Line Value\nSecond Line Value', |
80 dependentLocality: 'Dependent Locality Value', | 87 dependentLocality: 'Dependent Locality Value', |
81 city: 'City Value', | 88 city: 'City Value', |
82 state: 'State Value', | 89 state: 'State Value', |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 // phoneList.blur(); | 212 // phoneList.blur(); |
206 // makes the result more deterministic when the test is run by itself. | 213 // makes the result more deterministic when the test is run by itself. |
207 // | 214 // |
208 // phoneList.blur() calls cr.ui.List.handleElementBlur_, which triggers | 215 // phoneList.blur() calls cr.ui.List.handleElementBlur_, which triggers |
209 // InlineEditableItemList.handleListFocusChange_, which sends the | 216 // InlineEditableItemList.handleListFocusChange_, which sends the |
210 // 'commitedit' event. | 217 // 'commitedit' event. |
211 phoneList.blur(); | 218 phoneList.blur(); |
212 phoneList.doneValidating().then(testDone); | 219 phoneList.doneValidating().then(testDone); |
213 }); | 220 }); |
214 }); | 221 }); |
OLD | NEW |