| 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 3940620dfa92a3d48e7b140a3df5fcad8efc6395..fa78953ba9aabfa0375c2fbaaed0592f679d460f 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_;
|
| @@ -2912,4 +2923,33 @@ TEST_F(AutofillDialogControllerTest, IconReservedForCreditCardField) {
|
| }
|
| }
|
|
|
| +TEST_F(AutofillDialogControllerTest, CountryChange) {
|
| + CommandLine* command_line = CommandLine::ForCurrentProcess();
|
| + command_line->AppendSwitch(::switches::kEnableAutofillAddressI18n);
|
| + Reset();
|
| +
|
| + TestAutofillDialogView* view = controller()->GetView();
|
| + view->ClearSectionUpdates();
|
| +
|
| + controller()->ComboboxItemSelected(ADDRESS_HOME_COUNTRY, 2);
|
| + std::map<DialogSection, size_t> updates = view->section_updates();
|
| + EXPECT_EQ(1U, updates[SECTION_SHIPPING]);
|
| + EXPECT_EQ(1U, updates.size());
|
| +
|
| + view->ClearSectionUpdates();
|
| +
|
| + controller()->ComboboxItemSelected(ADDRESS_BILLING_COUNTRY, 3);
|
| + updates = view->section_updates();
|
| + EXPECT_EQ(1U, updates[SECTION_CC_BILLING]);
|
| + EXPECT_EQ(1U, updates.size());
|
| +
|
| + SwitchToAutofill();
|
| + view->ClearSectionUpdates();
|
| +
|
| + controller()->ComboboxItemSelected(ADDRESS_BILLING_COUNTRY, 4);
|
| + updates = view->section_updates();
|
| + EXPECT_EQ(1U, updates[SECTION_BILLING]);
|
| + EXPECT_EQ(1U, updates.size());
|
| +}
|
| +
|
| } // namespace autofill
|
|
|