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

Side by Side Diff: chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc

Issue 322453003: autocomplete: support address-line3, address-level{1,2,3} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update autofill_metrics.cc Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <map> 5 #include <map>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 3133 matching lines...) Expand 10 before | Expand all | Expand 10 after
3144 }; 3144 };
3145 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 3145 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
3146 for (size_t i = 0; i < arraysize(kSupportedCardIdrs); ++i) { 3146 for (size_t i = 0; i < arraysize(kSupportedCardIdrs); ++i) {
3147 SCOPED_TRACE(base::IntToString(i)); 3147 SCOPED_TRACE(base::IntToString(i));
3148 gfx::Image supported_card_icon = rb.GetImageNamed(kSupportedCardIdrs[i]); 3148 gfx::Image supported_card_icon = rb.GetImageNamed(kSupportedCardIdrs[i]);
3149 EXPECT_GE(placeholder_icon.Width(), supported_card_icon.Width()); 3149 EXPECT_GE(placeholder_icon.Width(), supported_card_icon.Width());
3150 EXPECT_GE(placeholder_icon.Height(), supported_card_icon.Height()); 3150 EXPECT_GE(placeholder_icon.Height(), supported_card_icon.Height());
3151 } 3151 }
3152 } 3152 }
3153 3153
3154 TEST_F(AutofillDialogControllerTest, NoPartiallySupportedCountriesSuggested) {
3155 SwitchToAutofill();
3156
3157 std::string partially_supported_country = "KR";
3158 ASSERT_FALSE(i18ninput::CountryIsFullySupported(partially_supported_country));
3159 ASSERT_FALSE(controller()->MenuModelForSection(SECTION_BILLING));
3160
3161 AutofillProfile verified_profile(test::GetVerifiedProfile());
3162 verified_profile.SetRawInfo(ADDRESS_HOME_COUNTRY,
3163 ASCIIToUTF16(partially_supported_country));
3164 controller()->GetTestingManager()->AddTestingProfile(&verified_profile);
3165
3166 EXPECT_FALSE(
3167 controller()->SuggestionStateForSection(SECTION_BILLING).visible);
3168 }
3169
3170 TEST_F(AutofillDialogControllerTest, CountryChangeUpdatesSection) { 3154 TEST_F(AutofillDialogControllerTest, CountryChangeUpdatesSection) {
3171 TestAutofillDialogView* view = controller()->GetView(); 3155 TestAutofillDialogView* view = controller()->GetView();
3172 view->ClearSectionUpdates(); 3156 view->ClearSectionUpdates();
3173 3157
3174 controller()->UserEditedOrActivatedInput(SECTION_SHIPPING, 3158 controller()->UserEditedOrActivatedInput(SECTION_SHIPPING,
3175 ADDRESS_HOME_COUNTRY, 3159 ADDRESS_HOME_COUNTRY,
3176 gfx::NativeView(), 3160 gfx::NativeView(),
3177 gfx::Rect(), 3161 gfx::Rect(),
3178 ASCIIToUTF16("Belarus"), 3162 ASCIIToUTF16("Belarus"),
3179 true); 3163 true);
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
3567 EXPECT_EQ(ASCIIToUTF16("United States"), form_structure()->field(2)->value); 3551 EXPECT_EQ(ASCIIToUTF16("United States"), form_structure()->field(2)->value);
3568 EXPECT_EQ(ADDRESS_HOME_COUNTRY, 3552 EXPECT_EQ(ADDRESS_HOME_COUNTRY,
3569 form_structure()->field(3)->Type().GetStorableType()); 3553 form_structure()->field(3)->Type().GetStorableType());
3570 EXPECT_EQ(ASCIIToUTF16("US"), form_structure()->field(3)->value); 3554 EXPECT_EQ(ASCIIToUTF16("US"), form_structure()->field(3)->value);
3571 EXPECT_EQ(ADDRESS_HOME_COUNTRY, 3555 EXPECT_EQ(ADDRESS_HOME_COUNTRY,
3572 form_structure()->field(4)->Type().GetStorableType()); 3556 form_structure()->field(4)->Type().GetStorableType());
3573 EXPECT_EQ(ASCIIToUTF16("United States"), form_structure()->field(4)->value); 3557 EXPECT_EQ(ASCIIToUTF16("United States"), form_structure()->field(4)->value);
3574 } 3558 }
3575 3559
3576 } // namespace autofill 3560 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698