Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1982)

Unified Diff: chrome/test/data/webui/settings/settings_autofill_section_browsertest.js

Issue 2453773003: Alerting the user when the provided date for credit card is passed, not save the card, and not clos… (Closed)
Patch Set: Make the UI look like mocks again. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a65827dbb1e773d8f0058f1ced4c0d16be405ccd..c156739db3e546000387a055a55f6e5da34f1a96 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() - 2;
+ // works fine for January.
+ creditCard.expirationMonth = now.getMonth() - 1;
+
+ 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);
+ });
+ creditCardDialog.addEventListener('tap', function() {
+ // Test is |done| in a timeout in order to ensure that
+ // 'save-credit-card' is NOT fired after this test.
+ assertFalse(creditCardDialog.$.expired.hidden);
+ window.setTimeout(done, 100);
+ });
+ MockInteractions.tap(creditCardDialog.$.saveButton);
+ });
+ });
+
// Test will timeout if event is not received.
test('verifySaveCreditCardEdit', function(done) {
var creditCard = FakeDataMaker.emptyCreditCardEntry();
@@ -310,6 +337,7 @@ TEST_F('SettingsAutofillSectionBrowserTest', 'CreditCardTests', function() {
return test_util.whenAttributeIs(
creditCardDialog.$.dialog, 'open', true).then(function() {
+ assertTrue(creditCardDialog.$.expired.hidden);
creditCardDialog.addEventListener('save-credit-card', function(event) {
assertEquals(creditCard.guid, event.detail.guid);
done();
@@ -565,7 +593,6 @@ TEST_F('SettingsAutofillSectionBrowserTest', 'AddressTests', function() {
// Fail the test because the save event should not be called when
// cancel is clicked.
assertTrue(false);
- done();
});
dialog.addEventListener('close', function() {
« no previous file with comments | « chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698