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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 * Creates the Edit Address dialog and fulfills the promise when the dialog | 148 * Creates the Edit Address dialog and fulfills the promise when the dialog |
149 * has actually opened. | 149 * has actually opened. |
150 * @param {!chrome.autofillPrivate.AddressEntry} address | 150 * @param {!chrome.autofillPrivate.AddressEntry} address |
151 * @return {!Promise<Object>} | 151 * @return {!Promise<Object>} |
152 */ | 152 */ |
153 createAddressDialog_: function(address) { | 153 createAddressDialog_: function(address) { |
154 return new Promise(function(resolve) { | 154 return new Promise(function(resolve) { |
155 var section = document.createElement('settings-address-edit-dialog'); | 155 var section = document.createElement('settings-address-edit-dialog'); |
156 section.address = address; | 156 section.address = address; |
157 document.body.appendChild(section); | 157 document.body.appendChild(section); |
158 section.addEventListener('iron-overlay-opened', function() { | 158 section.addEventListener('on-update-address-wrapper', function() { |
159 resolve(section); | 159 resolve(section); |
160 }); | 160 }); |
161 }); | 161 }); |
162 }, | 162 }, |
163 | 163 |
164 /** | 164 /** |
165 * Creates the Edit Credit Card dialog. | 165 * Creates the Edit Credit Card dialog. |
166 * @param {!chrome.autofillPrivate.CreditCardEntry} creditCardItem | 166 * @param {!chrome.autofillPrivate.CreditCardEntry} creditCardItem |
167 * @return {!Object} | 167 * @return {!Object} |
168 */ | 168 */ |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 var creditCard = FakeDataMaker.emptyCreditCardEntry(); | 296 var creditCard = FakeDataMaker.emptyCreditCardEntry(); |
297 var creditCardDialog = self.createCreditCardDialog_(creditCard); | 297 var creditCardDialog = self.createCreditCardDialog_(creditCard); |
298 | 298 |
299 creditCardDialog.addEventListener('save-credit-card', function() { | 299 creditCardDialog.addEventListener('save-credit-card', function() { |
300 // Fail the test because the save event should not be called when cancel | 300 // Fail the test because the save event should not be called when cancel |
301 // is clicked. | 301 // is clicked. |
302 assertTrue(false); | 302 assertTrue(false); |
303 done(); | 303 done(); |
304 }); | 304 }); |
305 | 305 |
306 creditCardDialog.addEventListener('iron-overlay-closed', function() { | 306 creditCardDialog.addEventListener('close', function() { |
307 // Test is |done| in a timeout in order to ensure that | 307 // Test is |done| in a timeout in order to ensure that |
308 // 'save-credit-card' is NOT fired after this test. | 308 // 'save-credit-card' is NOT fired after this test. |
309 window.setTimeout(done, 100); | 309 window.setTimeout(done, 100); |
310 }); | 310 }); |
311 | 311 |
312 MockInteractions.tap(creditCardDialog.$.cancelButton); | 312 MockInteractions.tap(creditCardDialog.$.cancelButton); |
313 }); | 313 }); |
314 }); | 314 }); |
315 | 315 |
316 mocha.run(); | 316 mocha.run(); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 test('verifyCancelDoesNotSaveAddress', function(done) { | 505 test('verifyCancelDoesNotSaveAddress', function(done) { |
506 self.createAddressDialog_( | 506 self.createAddressDialog_( |
507 FakeDataMaker.addressEntry()).then(function(dialog) { | 507 FakeDataMaker.addressEntry()).then(function(dialog) { |
508 dialog.addEventListener('save-address', function() { | 508 dialog.addEventListener('save-address', function() { |
509 // Fail the test because the save event should not be called when | 509 // Fail the test because the save event should not be called when |
510 // cancel is clicked. | 510 // cancel is clicked. |
511 assertTrue(false); | 511 assertTrue(false); |
512 done(); | 512 done(); |
513 }); | 513 }); |
514 | 514 |
515 dialog.addEventListener('iron-overlay-closed', function() { | 515 dialog.addEventListener('close', function() { |
516 // Test is |done| in a timeout in order to ensure that | 516 // Test is |done| in a timeout in order to ensure that |
517 // 'save-address' is NOT fired after this test. | 517 // 'save-address' is NOT fired after this test. |
518 window.setTimeout(done, 100); | 518 window.setTimeout(done, 100); |
519 }); | 519 }); |
520 | 520 |
521 MockInteractions.tap(dialog.$.cancelButton); | 521 MockInteractions.tap(dialog.$.cancelButton); |
522 }); | 522 }); |
523 }); | 523 }); |
524 }); | 524 }); |
525 | 525 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 assertEquals(city, cols[0].value); | 751 assertEquals(city, cols[0].value); |
752 assertEquals(state, cols[1].value); | 752 assertEquals(state, cols[1].value); |
753 assertEquals(zip, cols[2].value); | 753 assertEquals(zip, cols[2].value); |
754 }); | 754 }); |
755 }); | 755 }); |
756 }); | 756 }); |
757 }); | 757 }); |
758 | 758 |
759 mocha.run(); | 759 mocha.run(); |
760 }); | 760 }); |
OLD | NEW |