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

Unified Diff: chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc

Issue 85863003: Change DetailOutputMap to FieldValueMap (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 7 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 | « no previous file | chrome/browser/ui/autofill/autofill_dialog_controller_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc
index eaceee243dd6ca6b664cde8d2c7ad964e0bc6ac0..e36e4f41b600d549ce3f9813ca19906fe3362083 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc
@@ -135,7 +135,7 @@ class TestAutofillDialogController : public AutofillDialogControllerImpl {
virtual ValidityMessages InputsAreValid(
DialogSection section,
- const DetailOutputMap& inputs) OVERRIDE {
+ const FieldValueMap& inputs) OVERRIDE {
if (!use_validation_)
return ValidityMessages();
return AutofillDialogControllerImpl::InputsAreValid(section, inputs);
@@ -170,7 +170,7 @@ class TestAutofillDialogController : public AutofillDialogControllerImpl {
}
using AutofillDialogControllerImpl::IsEditingExistingData;
- using AutofillDialogControllerImpl::IsManuallyEditingSection;
+ using AutofillDialogControllerImpl::IsPayingWithWallet;
using AutofillDialogControllerImpl::IsSubmitPausedOn;
using AutofillDialogControllerImpl::OnDidLoadRiskFingerprintData;
using AutofillDialogControllerImpl::AccountChooserModelForTesting;
@@ -896,52 +896,15 @@ IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest, NoCvcSegfault) {
IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest, MAYBE_PreservedSections) {
controller()->set_use_validation(true);
- // Set up some Autofill state.
- CreditCard credit_card(test::GetVerifiedCreditCard());
- controller()->GetTestingManager()->AddTestingCreditCard(&credit_card);
-
- AutofillProfile profile(test::GetVerifiedProfile());
- controller()->GetTestingManager()->AddTestingProfile(&profile);
-
- EXPECT_TRUE(controller()->SectionIsActive(SECTION_CC));
- EXPECT_TRUE(controller()->SectionIsActive(SECTION_BILLING));
- EXPECT_FALSE(controller()->SectionIsActive(SECTION_CC_BILLING));
- EXPECT_TRUE(controller()->SectionIsActive(SECTION_SHIPPING));
-
- EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_CC));
- EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_BILLING));
- EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_SHIPPING));
-
- // Set up some Wallet state.
- controller()->OnDidFetchWalletCookieValue(std::string());
- controller()->OnDidGetWalletItems(
- wallet::GetTestWalletItems(wallet::AMEX_DISALLOWED));
-
- ui::MenuModel* account_chooser = controller()->MenuModelForAccountChooser();
- ASSERT_TRUE(account_chooser->IsItemCheckedAt(0));
-
- // Check that the view's in the state we expect before starting to simulate
- // user input.
- EXPECT_FALSE(controller()->SectionIsActive(SECTION_CC));
- EXPECT_FALSE(controller()->SectionIsActive(SECTION_BILLING));
- EXPECT_TRUE(controller()->SectionIsActive(SECTION_CC_BILLING));
- EXPECT_TRUE(controller()->SectionIsActive(SECTION_SHIPPING));
-
- EXPECT_TRUE(controller()->IsManuallyEditingSection(SECTION_CC_BILLING));
-
- // Create some valid inputted billing data.
- const DetailInput& cc_number =
- controller()->RequestedFieldsForSection(SECTION_CC_BILLING)[0];
- EXPECT_EQ(CREDIT_CARD_NUMBER, cc_number.type);
TestableAutofillDialogView* view = controller()->GetTestableView();
- view->SetTextContentsOfInput(cc_number, ASCIIToUTF16("4111111111111111"));
-
- // Select "Add new shipping info..." from suggestions menu.
- ui::MenuModel* shipping_model =
- controller()->MenuModelForSection(SECTION_SHIPPING);
- shipping_model->ActivatedAt(shipping_model->GetItemCount() - 2);
- EXPECT_TRUE(controller()->IsManuallyEditingSection(SECTION_SHIPPING));
+ {
+ // Create some valid inputted billing data.
+ const DetailInput& cc_number =
+ controller()->RequestedFieldsForSection(SECTION_CC)[0];
+ DCHECK_EQ(cc_number.type, CREDIT_CARD_NUMBER);
+ view->SetTextContentsOfInput(cc_number, ASCIIToUTF16("4111111111111111"));
+ }
// Create some invalid, manually inputted shipping data.
const DetailInput& shipping_zip =
@@ -949,28 +912,37 @@ IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest, MAYBE_PreservedSections) {
ASSERT_EQ(ADDRESS_HOME_ZIP, shipping_zip.type);
view->SetTextContentsOfInput(shipping_zip, ASCIIToUTF16("shipping zip"));
- // Switch to using Autofill.
- account_chooser->ActivatedAt(account_chooser->GetItemCount() - 1);
+ // Switch to Wallet by simulating a successful server response.
+ controller()->OnDidFetchWalletCookieValue(std::string());
+ controller()->OnDidGetWalletItems(
+ wallet::GetTestWalletItems(wallet::AMEX_DISALLOWED));
+ ASSERT_TRUE(controller()->IsPayingWithWallet());
+
+ {
+ // The valid data should be preserved.
+ const DetailInput& cc_number =
+ controller()->RequestedFieldsForSection(SECTION_CC_BILLING)[0];
+ EXPECT_EQ(cc_number.type, CREDIT_CARD_NUMBER);
+ EXPECT_EQ(ASCIIToUTF16("4111111111111111"),
+ view->GetTextContentsOfInput(cc_number));
+ }
+
+ // The invalid data should be dropped.
+ EXPECT_TRUE(view->GetTextContentsOfInput(shipping_zip).empty());
- // Check that appropriate sections are preserved and in manually editing mode
- // (or disabled, in the case of the combined cc + billing section).
- EXPECT_TRUE(controller()->SectionIsActive(SECTION_CC));
- EXPECT_TRUE(controller()->SectionIsActive(SECTION_BILLING));
- EXPECT_FALSE(controller()->SectionIsActive(SECTION_CC_BILLING));
- EXPECT_TRUE(controller()->SectionIsActive(SECTION_SHIPPING));
-
- EXPECT_TRUE(controller()->IsManuallyEditingSection(SECTION_CC));
- EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_BILLING));
- EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_SHIPPING));
-
- const DetailInput& new_cc_number =
- controller()->RequestedFieldsForSection(SECTION_CC).front();
- EXPECT_EQ(cc_number.type, new_cc_number.type);
- EXPECT_EQ(ASCIIToUTF16("4111111111111111"),
- view->GetTextContentsOfInput(new_cc_number));
-
- EXPECT_NE(ASCIIToUTF16("shipping name"),
- view->GetTextContentsOfInput(shipping_zip));
+ // Switch back to Autofill.
+ ui::MenuModel* account_chooser = controller()->MenuModelForAccountChooser();
+ account_chooser->ActivatedAt(account_chooser->GetItemCount() - 1);
+ ASSERT_FALSE(controller()->IsPayingWithWallet());
+
+ {
+ // The valid data should still be preserved when switched back.
+ const DetailInput& cc_number =
+ controller()->RequestedFieldsForSection(SECTION_CC)[0];
+ EXPECT_EQ(cc_number.type, CREDIT_CARD_NUMBER);
+ EXPECT_EQ(ASCIIToUTF16("4111111111111111"),
+ view->GetTextContentsOfInput(cc_number));
+ }
}
#endif // defined(TOOLKIT_VIEWS) || defined(OS_MACOSX)
« no previous file with comments | « no previous file | chrome/browser/ui/autofill/autofill_dialog_controller_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698