Chromium Code Reviews| Index: chrome/test/data/webui/settings/settings_autofill_section_browsertest.js |
| diff --git a/chrome/test/data/webui/settings/settings_autofill_section_browsertest.js b/chrome/test/data/webui/settings/settings_autofill_section_browsertest.js |
| index 988b092d2923d69395b22fafec1cf3a83be5f7fc..308208095d89eaa96e84ad9394e19010e55d2d34 100644 |
| --- a/chrome/test/data/webui/settings/settings_autofill_section_browsertest.js |
| +++ b/chrome/test/data/webui/settings/settings_autofill_section_browsertest.js |
| @@ -303,6 +303,33 @@ TEST_F('SettingsAutofillSectionBrowserTest', 'CreditCardTests', function() { |
| }); |
| }); |
| + test('verifySaveExpiredCreditCardEdit', function(done) { |
| + var creditCard = FakeDataMaker.emptyCreditCardEntry(); |
| + |
| + var now = new Date(); |
| + creditCard.expirationYear = now.getFullYear(); |
|
Moe
2016/10/27 18:31:11
Can you refactor your test to have a test for year
Parastoo
2016/10/27 22:18:57
Done.
|
| + creditCard.expirationMonth = now.getMonth() - 1; |
|
Mathieu
2016/10/27 15:49:56
If this test runs in January this will be -1?
Parastoo
2016/10/27 16:08:40
Yes, and it's safe. I tested it. Is it OK to leave
Parastoo
2016/10/27 22:18:57
Done.
|
| + |
| + var creditCardDialog = self.createCreditCardDialog_(creditCard); |
| + |
| + return test_util.whenAttributeIs( |
| + creditCardDialog.$.dialog, 'open', true).then(function() { |
| + creditCardDialog.addEventListener('save-credit-card', function() { |
| + // Fail the test because the save event should not be called when |
| + // the card is expired. |
| + assertTrue(false); |
| + done(); |
|
Moe
2016/10/27 18:31:11
I don't think this last line will be even reached.
Parastoo
2016/10/27 22:18:57
Done.
|
| + }); |
| + creditCardDialog.addEventListener('tap', function() { |
| + // Test is |done| in a timeout in order to ensure that |
| + // 'save-credit-card' is NOT fired after this test. |
| + window.setTimeout(done, 100); |
|
Mathieu
2016/10/27 15:49:57
is it possible to assert that the error shows?
Parastoo
2016/10/27 16:08:40
I have to figure out how.
Moe
2016/10/27 18:31:11
assertTrue(!!creditCardDialog.$$(...)) if you're u
Moe
2016/10/27 18:35:08
correction: assertTrue(creditCardDialog.$$(...).cl
Parastoo
2016/10/27 22:18:57
Done.
|
| + }); |
| + |
| + MockInteractions.tap(creditCardDialog.$.saveButton); |
| + }); |
| + }); |
| + |
| // Test will timeout if event is not received. |
| test('verifySaveCreditCardEdit', function(done) { |
| var creditCard = FakeDataMaker.emptyCreditCardEntry(); |