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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 * Creates the Edit Address dialog and fulfills the promise when the dialog | 159 * Creates the Edit Address dialog and fulfills the promise when the dialog |
160 * has actually opened. | 160 * has actually opened. |
161 * @param {!chrome.autofillPrivate.AddressEntry} address | 161 * @param {!chrome.autofillPrivate.AddressEntry} address |
162 * @return {!Promise<Object>} | 162 * @return {!Promise<Object>} |
163 */ | 163 */ |
164 createAddressDialog_: function(address) { | 164 createAddressDialog_: function(address) { |
165 return new Promise(function(resolve) { | 165 return new Promise(function(resolve) { |
166 var section = document.createElement('settings-address-edit-dialog'); | 166 var section = document.createElement('settings-address-edit-dialog'); |
167 section.address = address; | 167 section.address = address; |
168 document.body.appendChild(section); | 168 document.body.appendChild(section); |
169 section.addEventListener('iron-overlay-opened', function() { | 169 section.addEventListener('on-update-address-wrapper', function() { |
170 resolve(section); | 170 resolve(section); |
171 }); | 171 }); |
172 }); | 172 }); |
173 }, | 173 }, |
174 | 174 |
175 /** | 175 /** |
176 * Creates the Edit Credit Card dialog. | 176 * Creates the Edit Credit Card dialog. |
177 * @param {!chrome.autofillPrivate.CreditCardEntry} creditCardItem | 177 * @param {!chrome.autofillPrivate.CreditCardEntry} creditCardItem |
178 * @return {!Object} | 178 * @return {!Object} |
179 */ | 179 */ |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 var creditCard = FakeDataMaker.emptyCreditCardEntry(); | 308 var creditCard = FakeDataMaker.emptyCreditCardEntry(); |
309 var creditCardDialog = self.createCreditCardDialog_(creditCard); | 309 var creditCardDialog = self.createCreditCardDialog_(creditCard); |
310 | 310 |
311 creditCardDialog.addEventListener('save-credit-card', function() { | 311 creditCardDialog.addEventListener('save-credit-card', function() { |
312 // Fail the test because the save event should not be called when cancel | 312 // Fail the test because the save event should not be called when cancel |
313 // is clicked. | 313 // is clicked. |
314 assertTrue(false); | 314 assertTrue(false); |
315 done(); | 315 done(); |
316 }); | 316 }); |
317 | 317 |
318 creditCardDialog.addEventListener('iron-overlay-closed', function() { | 318 creditCardDialog.addEventListener('close', function() { |
319 // Test is |done| in a timeout in order to ensure that | 319 // Test is |done| in a timeout in order to ensure that |
320 // 'save-credit-card' is NOT fired after this test. | 320 // 'save-credit-card' is NOT fired after this test. |
321 window.setTimeout(done, 100); | 321 window.setTimeout(done, 100); |
322 }); | 322 }); |
323 | 323 |
324 MockInteractions.tap(creditCardDialog.$.cancelButton); | 324 MockInteractions.tap(creditCardDialog.$.cancelButton); |
325 }); | 325 }); |
326 }); | 326 }); |
327 | 327 |
328 mocha.run(); | 328 mocha.run(); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 test('verifyCancelDoesNotSaveAddress', function(done) { | 518 test('verifyCancelDoesNotSaveAddress', function(done) { |
519 self.createAddressDialog_( | 519 self.createAddressDialog_( |
520 FakeDataMaker.addressEntry()).then(function(dialog) { | 520 FakeDataMaker.addressEntry()).then(function(dialog) { |
521 dialog.addEventListener('save-address', function() { | 521 dialog.addEventListener('save-address', function() { |
522 // Fail the test because the save event should not be called when | 522 // Fail the test because the save event should not be called when |
523 // cancel is clicked. | 523 // cancel is clicked. |
524 assertTrue(false); | 524 assertTrue(false); |
525 done(); | 525 done(); |
526 }); | 526 }); |
527 | 527 |
528 dialog.addEventListener('iron-overlay-closed', function() { | 528 dialog.addEventListener('close', function() { |
529 // Test is |done| in a timeout in order to ensure that | 529 // Test is |done| in a timeout in order to ensure that |
530 // 'save-address' is NOT fired after this test. | 530 // 'save-address' is NOT fired after this test. |
531 window.setTimeout(done, 100); | 531 window.setTimeout(done, 100); |
532 }); | 532 }); |
533 | 533 |
534 MockInteractions.tap(dialog.$.cancelButton); | 534 MockInteractions.tap(dialog.$.cancelButton); |
535 }); | 535 }); |
536 }); | 536 }); |
537 }); | 537 }); |
538 | 538 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 assertEquals(city, cols[0].value); | 764 assertEquals(city, cols[0].value); |
765 assertEquals(state, cols[1].value); | 765 assertEquals(state, cols[1].value); |
766 assertEquals(zip, cols[2].value); | 766 assertEquals(zip, cols[2].value); |
767 }); | 767 }); |
768 }); | 768 }); |
769 }); | 769 }); |
770 }); | 770 }); |
771 | 771 |
772 mocha.run(); | 772 mocha.run(); |
773 }); | 773 }); |
OLD | NEW |