OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 /** @fileoverview Runs the Polymer Autofill Settings tests. */ | 5 /** @fileoverview Runs the Polymer Autofill Settings tests. */ |
6 | 6 |
7 /** @const {string} Path to root from chrome/test/data/webui/settings/. */ | 7 /** @const {string} Path to root from chrome/test/data/webui/settings/. */ |
8 var ROOT_PATH = '../../../../../'; | 8 var ROOT_PATH = '../../../../../'; |
9 | 9 |
10 // Polymer BrowserTest fixture. | 10 // Polymer BrowserTest fixture. |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 __proto__: PolymerTest.prototype, | 92 __proto__: PolymerTest.prototype, |
93 | 93 |
94 /** @override */ | 94 /** @override */ |
95 browsePreload: | 95 browsePreload: |
96 'chrome://md-settings/passwords_and_forms_page/autofill_section.html', | 96 'chrome://md-settings/passwords_and_forms_page/autofill_section.html', |
97 | 97 |
98 /** @override */ | 98 /** @override */ |
99 extraLibraries: PolymerTest.getLibraries(ROOT_PATH).concat([ | 99 extraLibraries: PolymerTest.getLibraries(ROOT_PATH).concat([ |
100 'passwords_and_autofill_fake_data.js', | 100 'passwords_and_autofill_fake_data.js', |
101 'test_util.js', | 101 'test_util.js', |
| 102 'ensure_lazy_loaded.js', |
102 ]), | 103 ]), |
103 | 104 |
104 /** | 105 /** |
105 * TODO(hcarmona): Increases speed, but disables A11y checks. Enable checks | 106 * TODO(hcarmona): Increases speed, but disables A11y checks. Enable checks |
106 * when we "accessibilityIssuesAreErrors: true" for all tests. | 107 * when we "accessibilityIssuesAreErrors: true" for all tests. |
107 * @override | 108 * @override |
108 */ | 109 */ |
109 runAccessibilityChecks: false, | 110 runAccessibilityChecks: false, |
110 | 111 |
111 /** @override */ | 112 /** @override */ |
112 setUp: function() { | 113 setUp: function() { |
113 PolymerTest.prototype.setUp.call(this); | 114 PolymerTest.prototype.setUp.call(this); |
114 | 115 |
115 // Test is run on an individual element that won't have a page language. | 116 // Test is run on an individual element that won't have a page language. |
116 this.accessibilityAuditConfig.auditRulesToIgnore.push('humanLangMissing'); | 117 this.accessibilityAuditConfig.auditRulesToIgnore.push('humanLangMissing'); |
117 | 118 |
118 settings.address.CountryDetailManagerImpl.instance_ = | 119 settings.ensureLazyLoaded(); |
119 new CountryDetailManagerTestImpl(); | |
120 }, | 120 }, |
121 | 121 |
122 /** | 122 /** |
123 * Creates the autofill section for the given lists. | 123 * Creates the autofill section for the given lists. |
124 * @param {!Array<!chrome.passwordsPrivate.PasswordUiEntry>} passwordList | 124 * @param {!Array<!chrome.passwordsPrivate.PasswordUiEntry>} passwordList |
125 * @param {!Array<!chrome.passwordsPrivate.ExceptionPair>} exceptionList | 125 * @param {!Array<!chrome.passwordsPrivate.ExceptionPair>} exceptionList |
126 * @return {!Object} | 126 * @return {!Object} |
127 * @private | 127 * @private |
128 */ | 128 */ |
129 createAutofillSection_: function(addresses, creditCards) { | 129 createAutofillSection_: function(addresses, creditCards) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 section.creditCard = creditCardItem; | 166 section.creditCard = creditCardItem; |
167 document.body.appendChild(section); | 167 document.body.appendChild(section); |
168 Polymer.dom.flush(); | 168 Polymer.dom.flush(); |
169 return section; | 169 return section; |
170 }, | 170 }, |
171 }; | 171 }; |
172 | 172 |
173 TEST_F('SettingsAutofillSectionBrowserTest', 'CreditCardTests', function() { | 173 TEST_F('SettingsAutofillSectionBrowserTest', 'CreditCardTests', function() { |
174 var self = this; | 174 var self = this; |
175 | 175 |
176 setup(function() { | 176 suite('AutofillSection', function() { |
177 PolymerTest.clearBody(); | 177 suiteSetup(function() { |
178 }); | 178 settings.address.CountryDetailManagerImpl.instance_ = |
| 179 new CountryDetailManagerTestImpl(); |
| 180 }); |
179 | 181 |
180 suite('AutofillSection', function() { | 182 setup(function() { |
| 183 PolymerTest.clearBody(); |
| 184 }); |
| 185 |
181 test('verifyCreditCardCount', function() { | 186 test('verifyCreditCardCount', function() { |
182 var section = self.createAutofillSection_([], []); | 187 var section = self.createAutofillSection_([], []); |
183 assertTrue(!!section); | 188 assertTrue(!!section); |
184 | 189 |
185 var creditCardList = section.$.creditCardList; | 190 var creditCardList = section.$.creditCardList; |
186 assertTrue(!!creditCardList); | 191 assertTrue(!!creditCardList); |
187 // +1 for the template element. | 192 // +1 for the template element. |
188 assertEquals(1, creditCardList.children.length); | 193 assertEquals(1, creditCardList.children.length); |
189 | 194 |
190 assertFalse(section.$.noCreditCardsLabel.hidden); | 195 assertFalse(section.$.noCreditCardsLabel.hidden); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 }); | 415 }); |
411 }); | 416 }); |
412 }); | 417 }); |
413 | 418 |
414 mocha.run(); | 419 mocha.run(); |
415 }); | 420 }); |
416 | 421 |
417 TEST_F('SettingsAutofillSectionBrowserTest', 'AddressTests', function() { | 422 TEST_F('SettingsAutofillSectionBrowserTest', 'AddressTests', function() { |
418 var self = this; | 423 var self = this; |
419 | 424 |
420 setup(function() { | |
421 PolymerTest.clearBody(); | |
422 }); | |
423 | 425 |
424 suite('AutofillSection', function() { | 426 suite('AutofillSection', function() { |
| 427 suiteSetup(function() { |
| 428 settings.address.CountryDetailManagerImpl.instance_ = |
| 429 new CountryDetailManagerTestImpl(); |
| 430 }); |
| 431 |
| 432 setup(function() { |
| 433 PolymerTest.clearBody(); |
| 434 }); |
| 435 |
425 test('verifyNoAddresses', function() { | 436 test('verifyNoAddresses', function() { |
426 var section = self.createAutofillSection_([], []); | 437 var section = self.createAutofillSection_([], []); |
427 assertTrue(!!section); | 438 assertTrue(!!section); |
428 | 439 |
429 var addressList = section.$.addressList; | 440 var addressList = section.$.addressList; |
430 assertTrue(!!addressList); | 441 assertTrue(!!addressList); |
431 // 1 for the template element. | 442 // 1 for the template element. |
432 assertEquals(1, addressList.children.length); | 443 assertEquals(1, addressList.children.length); |
433 | 444 |
434 assertFalse(section.$.noAddressesLabel.hidden); | 445 assertFalse(section.$.noAddressesLabel.hidden); |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 }); | 695 }); |
685 }); | 696 }); |
686 }); | 697 }); |
687 | 698 |
688 mocha.run(); | 699 mocha.run(); |
689 }); | 700 }); |
690 | 701 |
691 TEST_F('SettingsAutofillSectionBrowserTest', 'AddressLocaleTests', function() { | 702 TEST_F('SettingsAutofillSectionBrowserTest', 'AddressLocaleTests', function() { |
692 var self = this; | 703 var self = this; |
693 | 704 |
694 setup(function() { | 705 suite('AutofillSection', function() { |
695 PolymerTest.clearBody(); | 706 suiteSetup(function() { |
696 }); | 707 settings.address.CountryDetailManagerImpl.instance_ = |
| 708 new CountryDetailManagerTestImpl(); |
| 709 }); |
697 | 710 |
698 suite('AutofillSection', function() { | 711 setup(function() { |
| 712 PolymerTest.clearBody(); |
| 713 }); |
| 714 |
699 // US address has 3 fields on the same line. | 715 // US address has 3 fields on the same line. |
700 test('verifyEditingUSAddress', function() { | 716 test('verifyEditingUSAddress', function() { |
701 var address = FakeDataMaker.emptyAddressEntry(); | 717 var address = FakeDataMaker.emptyAddressEntry(); |
702 | 718 |
703 address.fullNames = [ 'Name' ]; | 719 address.fullNames = [ 'Name' ]; |
704 address.companyName = 'Organization'; | 720 address.companyName = 'Organization'; |
705 address.addressLines = 'Street address'; | 721 address.addressLines = 'Street address'; |
706 address.addressLevel2 = 'City'; | 722 address.addressLevel2 = 'City'; |
707 address.addressLevel1 = 'State'; | 723 address.addressLevel1 = 'State'; |
708 address.postalCode = 'ZIP code'; | 724 address.postalCode = 'ZIP code'; |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 assertEquals(city, cols[0].value); | 935 assertEquals(city, cols[0].value); |
920 assertEquals(state, cols[1].value); | 936 assertEquals(state, cols[1].value); |
921 assertEquals(zip, cols[2].value); | 937 assertEquals(zip, cols[2].value); |
922 }); | 938 }); |
923 }); | 939 }); |
924 }); | 940 }); |
925 }); | 941 }); |
926 | 942 |
927 mocha.run(); | 943 mocha.run(); |
928 }); | 944 }); |
OLD | NEW |