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

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

Issue 124533003: Add country combobox to change country and rebuild address inputs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment Created 6 years, 11 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
Index: chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
index 0cced33ac28a4612777ec13d33f002612afc9948..86b0dcc5ecfa28f6c6cfe19826948dd83bd84282 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
@@ -21,6 +21,7 @@
#include "chrome/browser/ui/autofill/mock_new_credit_card_bubble_controller.h"
#include "chrome/browser/ui/autofill/test_generated_credit_card_bubble_controller.h"
#include "chrome/browser/webdata/web_data_service_factory.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
@@ -170,6 +171,7 @@ class TestAutofillDialogView : public AutofillDialogView {
}
virtual void UpdateSection(DialogSection section) OVERRIDE {
+ section_updates_[section]++;
EXPECT_GE(updates_started_, 1);
}
@@ -215,8 +217,17 @@ class TestAutofillDialogView : public AutofillDialogView {
save_details_locally_checked_ = checked;
}
+ void ClearSectionUpdates() {
+ section_updates_.clear();
+ }
+
+ std::map<DialogSection, size_t> section_updates() const {
+ return section_updates_;
+ }
+
private:
std::map<DialogSection, FieldValueMap> outputs_;
+ std::map<DialogSection, size_t> section_updates_;
int updates_started_;
bool save_details_locally_checked_;
@@ -2923,4 +2934,49 @@ TEST_F(AutofillDialogControllerTest, IconReservedForCreditCardField) {
}
}
+TEST_F(AutofillDialogControllerTest, CountryChangeUpdatesSection) {
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ command_line->AppendSwitch(::switches::kEnableAutofillAddressI18n);
+
+ Reset();
+
+ TestAutofillDialogView* view = controller()->GetView();
+ view->ClearSectionUpdates();
+
+ controller()->UserEditedOrActivatedInput(SECTION_SHIPPING,
+ ADDRESS_HOME_COUNTRY,
+ gfx::NativeView(),
+ gfx::Rect(),
+ ASCIIToUTF16("China"),
+ true);
+ std::map<DialogSection, size_t> updates = view->section_updates();
+ EXPECT_EQ(1U, updates[SECTION_SHIPPING]);
+ EXPECT_EQ(1U, updates.size());
+
+ view->ClearSectionUpdates();
+
+ controller()->UserEditedOrActivatedInput(SECTION_CC_BILLING,
+ ADDRESS_BILLING_COUNTRY,
+ gfx::NativeView(),
+ gfx::Rect(),
+ ASCIIToUTF16("France"),
+ true);
+ updates = view->section_updates();
+ EXPECT_EQ(1U, updates[SECTION_CC_BILLING]);
+ EXPECT_EQ(1U, updates.size());
+
+ SwitchToAutofill();
+ view->ClearSectionUpdates();
+
+ controller()->UserEditedOrActivatedInput(SECTION_BILLING,
+ ADDRESS_BILLING_COUNTRY,
+ gfx::NativeView(),
+ gfx::Rect(),
+ ASCIIToUTF16("Italy"),
+ true);
+ updates = view->section_updates();
+ EXPECT_EQ(1U, updates[SECTION_BILLING]);
+ EXPECT_EQ(1U, updates.size());
+}
+
} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698