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

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

Issue 365463002: rAc: When filling partial autofill data, don't fill across dialog sections. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed comment Created 6 years, 5 months 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 09433dcaa3f95ef7a2da44f7feb8f0e3387f78f5..c9fc9cbf1198c5fc5fe8370b784cde505fe380d4 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc
@@ -672,11 +672,15 @@ IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest, FillInputFromAutofill) {
full_profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, formatted_phone);
controller()->GetTestingManager()->AddTestingProfile(&full_profile);
+ // Dialog is already asking for a new billing address.
+ EXPECT_TRUE(controller()->IsManuallyEditingSection(SECTION_BILLING));
+
// Select "Add new shipping address...".
ui::MenuModel* model = controller()->MenuModelForSection(SECTION_SHIPPING);
model->ActivatedAt(model->GetItemCount() - 2);
ASSERT_TRUE(controller()->IsManuallyEditingSection(SECTION_SHIPPING));
+ // Enter something in a shipping input.
const DetailInputs& inputs =
controller()->RequestedFieldsForSection(SECTION_SHIPPING);
const ServerFieldType triggering_type = inputs[0].type;
@@ -700,6 +704,21 @@ IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest, FillInputFromAutofill) {
EXPECT_EQ(formatted_phone, view->GetTextContentsOfInput(inputs[i].type));
}
+ // Inputs from the other section (billing) should be left alone.
+ const DetailInputs& other_section_inputs =
+ controller()->RequestedFieldsForSection(SECTION_BILLING);
+ for (size_t i = 0; i < inputs.size(); ++i) {
+ base::string16 input_value =
+ view->GetTextContentsOfInput(other_section_inputs[i].type);
+ // If there's a combobox, the string should be non-empty.
+ if (controller()->ComboboxModelForAutofillType(
+ other_section_inputs[i].type)) {
+ EXPECT_NE(base::string16(), input_value);
+ } else {
+ EXPECT_EQ(base::string16(), input_value);
+ }
+ }
+
// Now simulate some user edits and try again.
std::vector<base::string16> expectations;
for (size_t i = 0; i < inputs.size(); ++i) {
@@ -1671,15 +1690,16 @@ IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest,
ASSERT_EQ(ASCIIToUTF16("United States"),
view->GetTextContentsOfInput(ADDRESS_HOME_COUNTRY));
- base::string16 name = full_profile.GetRawInfo(NAME_FULL);
- view->SetTextContentsOfInput(NAME_FULL, name.substr(0, name.size() / 2));
- view->ActivateInput(NAME_FULL);
- ASSERT_EQ(NAME_FULL, controller()->popup_input_type());
+ const ServerFieldType input_type = EMAIL_ADDRESS;
+ base::string16 name = full_profile.GetRawInfo(input_type);
+ view->SetTextContentsOfInput(input_type, name.substr(0, name.size() / 2));
+ view->ActivateInput(input_type);
+ ASSERT_EQ(input_type, controller()->popup_input_type());
controller()->DidAcceptSuggestion(base::string16(), 0);
EXPECT_EQ(ASCIIToUTF16("Germany"),
view->GetTextContentsOfInput(ADDRESS_BILLING_COUNTRY));
- EXPECT_EQ(ASCIIToUTF16("Germany"),
+ EXPECT_EQ(ASCIIToUTF16("United States"),
view->GetTextContentsOfInput(ADDRESS_HOME_COUNTRY));
}
« 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