| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 Polymer.dom.flush(); | 173 Polymer.dom.flush(); |
| 174 return section; | 174 return section; |
| 175 }, | 175 }, |
| 176 }; | 176 }; |
| 177 | 177 |
| 178 TEST_F('SettingsAutofillSectionBrowserTest', 'CreditCardTests', function() { | 178 TEST_F('SettingsAutofillSectionBrowserTest', 'CreditCardTests', function() { |
| 179 var self = this; | 179 var self = this; |
| 180 | 180 |
| 181 suite('AutofillSection', function() { | 181 suite('AutofillSection', function() { |
| 182 test('verifyCreditCardCount', function() { | 182 test('verifyCreditCardCount', function() { |
| 183 var section = self.createAutofillSection_([], []); |
| 184 assertTrue(!!section); |
| 185 |
| 186 var creditCardList = section.$.creditCardList; |
| 187 assertTrue(!!creditCardList); |
| 188 // +1 for the template element. |
| 189 assertEquals(1, creditCardList.children.length); |
| 190 |
| 191 assertFalse(section.$.noCreditCardsLabel.hidden); |
| 192 assertTrue(section.$.creditCardsHeading.hidden); |
| 193 }); |
| 194 |
| 195 test('verifyCreditCardCount', function() { |
| 183 var creditCards = [ | 196 var creditCards = [ |
| 184 FakeDataMaker.creditCardEntry(), | 197 FakeDataMaker.creditCardEntry(), |
| 185 FakeDataMaker.creditCardEntry(), | 198 FakeDataMaker.creditCardEntry(), |
| 186 FakeDataMaker.creditCardEntry(), | 199 FakeDataMaker.creditCardEntry(), |
| 187 FakeDataMaker.creditCardEntry(), | 200 FakeDataMaker.creditCardEntry(), |
| 188 FakeDataMaker.creditCardEntry(), | 201 FakeDataMaker.creditCardEntry(), |
| 189 FakeDataMaker.creditCardEntry(), | 202 FakeDataMaker.creditCardEntry(), |
| 190 ]; | 203 ]; |
| 191 | 204 |
| 192 var section = self.createAutofillSection_([], creditCards); | 205 var section = self.createAutofillSection_([], creditCards); |
| 193 | 206 |
| 194 assertTrue(!!section); | 207 assertTrue(!!section); |
| 195 var creditCardList = section.$.creditCardList; | 208 var creditCardList = section.$.creditCardList; |
| 196 assertTrue(!!creditCardList); | 209 assertTrue(!!creditCardList); |
| 197 // +1 for the template element. | 210 // +1 for the template element. |
| 198 assertEquals(creditCards.length + 1, creditCardList.children.length); | 211 assertEquals(creditCards.length + 1, creditCardList.children.length); |
| 212 |
| 213 assertTrue(section.$.noCreditCardsLabel.hidden); |
| 214 assertFalse(section.$.creditCardsHeading.hidden); |
| 199 }); | 215 }); |
| 200 | 216 |
| 201 test('verifyCreditCardFields', function() { | 217 test('verifyCreditCardFields', function() { |
| 202 var creditCard = FakeDataMaker.creditCardEntry(); | 218 var creditCard = FakeDataMaker.creditCardEntry(); |
| 203 var section = self.createAutofillSection_([], [creditCard]); | 219 var section = self.createAutofillSection_([], [creditCard]); |
| 204 var creditCardList = section.$.creditCardList; | 220 var creditCardList = section.$.creditCardList; |
| 205 var row = creditCardList.children[0]; | 221 var row = creditCardList.children[0]; |
| 206 assertTrue(!!row); | 222 assertTrue(!!row); |
| 207 | 223 |
| 208 assertEquals(creditCard.metadata.summaryLabel, | 224 assertEquals(creditCard.metadata.summaryLabel, |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 }); | 329 }); |
| 314 }); | 330 }); |
| 315 | 331 |
| 316 mocha.run(); | 332 mocha.run(); |
| 317 }); | 333 }); |
| 318 | 334 |
| 319 TEST_F('SettingsAutofillSectionBrowserTest', 'AddressTests', function() { | 335 TEST_F('SettingsAutofillSectionBrowserTest', 'AddressTests', function() { |
| 320 var self = this; | 336 var self = this; |
| 321 | 337 |
| 322 suite('AutofillSection', function() { | 338 suite('AutofillSection', function() { |
| 339 test('verifyNoAddresses', function() { |
| 340 var section = self.createAutofillSection_([], []); |
| 341 assertTrue(!!section); |
| 342 |
| 343 var addressList = section.$.addressList; |
| 344 assertTrue(!!addressList); |
| 345 // 1 for the template element. |
| 346 assertEquals(1, addressList.children.length); |
| 347 |
| 348 assertFalse(section.$.noAddressesLabel.hidden); |
| 349 }); |
| 350 |
| 323 test('verifyAddressCount', function() { | 351 test('verifyAddressCount', function() { |
| 324 var addresses = [ | 352 var addresses = [ |
| 325 FakeDataMaker.addressEntry(), | 353 FakeDataMaker.addressEntry(), |
| 326 FakeDataMaker.addressEntry(), | 354 FakeDataMaker.addressEntry(), |
| 327 FakeDataMaker.addressEntry(), | 355 FakeDataMaker.addressEntry(), |
| 328 FakeDataMaker.addressEntry(), | 356 FakeDataMaker.addressEntry(), |
| 329 FakeDataMaker.addressEntry(), | 357 FakeDataMaker.addressEntry(), |
| 330 ]; | 358 ]; |
| 331 | 359 |
| 332 var section = self.createAutofillSection_(addresses, []); | 360 var section = self.createAutofillSection_(addresses, []); |
| 333 | 361 |
| 334 assertTrue(!!section); | 362 assertTrue(!!section); |
| 335 var addressList = section.$.addressList; | 363 var addressList = section.$.addressList; |
| 336 assertTrue(!!addressList); | 364 assertTrue(!!addressList); |
| 337 // +1 for the template element. | 365 // +1 for the template element. |
| 338 assertEquals(addresses.length + 1, addressList.children.length); | 366 assertEquals(addresses.length + 1, addressList.children.length); |
| 367 |
| 368 assertTrue(section.$.noAddressesLabel.hidden); |
| 339 }); | 369 }); |
| 340 | 370 |
| 341 test('verifyAddressFields', function() { | 371 test('verifyAddressFields', function() { |
| 342 var address = FakeDataMaker.addressEntry(); | 372 var address = FakeDataMaker.addressEntry(); |
| 343 var section = self.createAutofillSection_([address], []); | 373 var section = self.createAutofillSection_([address], []); |
| 344 var addressList = section.$.addressList; | 374 var addressList = section.$.addressList; |
| 345 var row = addressList.children[0]; | 375 var row = addressList.children[0]; |
| 346 assertTrue(!!row); | 376 assertTrue(!!row); |
| 347 | 377 |
| 348 var addressSummary = address.metadata.summaryLabel + | 378 var addressSummary = address.metadata.summaryLabel + |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 assertEquals(city, cols[0].value); | 781 assertEquals(city, cols[0].value); |
| 752 assertEquals(state, cols[1].value); | 782 assertEquals(state, cols[1].value); |
| 753 assertEquals(zip, cols[2].value); | 783 assertEquals(zip, cols[2].value); |
| 754 }); | 784 }); |
| 755 }); | 785 }); |
| 756 }); | 786 }); |
| 757 }); | 787 }); |
| 758 | 788 |
| 759 mocha.run(); | 789 mocha.run(); |
| 760 }); | 790 }); |
| OLD | NEW |