OLD | NEW |
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 2943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2954 }; | 2954 }; |
2955 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 2955 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
2956 for (size_t i = 0; i < arraysize(kSupportedCardIdrs); ++i) { | 2956 for (size_t i = 0; i < arraysize(kSupportedCardIdrs); ++i) { |
2957 SCOPED_TRACE(base::IntToString(i)); | 2957 SCOPED_TRACE(base::IntToString(i)); |
2958 gfx::Image supported_card_icon = rb.GetImageNamed(kSupportedCardIdrs[i]); | 2958 gfx::Image supported_card_icon = rb.GetImageNamed(kSupportedCardIdrs[i]); |
2959 EXPECT_GE(placeholder_icon.Width(), supported_card_icon.Width()); | 2959 EXPECT_GE(placeholder_icon.Width(), supported_card_icon.Width()); |
2960 EXPECT_GE(placeholder_icon.Height(), supported_card_icon.Height()); | 2960 EXPECT_GE(placeholder_icon.Height(), supported_card_icon.Height()); |
2961 } | 2961 } |
2962 } | 2962 } |
2963 | 2963 |
| 2964 TEST_F(AutofillDialogControllerTest, NoPartiallySupportedCountriesSuggested) { |
| 2965 SwitchToAutofill(); |
| 2966 |
| 2967 std::string partially_supported_country = "KR"; |
| 2968 ASSERT_FALSE(i18ninput::CountryIsFullySupported(partially_supported_country)); |
| 2969 ASSERT_FALSE(controller()->MenuModelForSection(SECTION_BILLING)); |
| 2970 |
| 2971 AutofillProfile verified_profile(test::GetVerifiedProfile()); |
| 2972 verified_profile.SetRawInfo(ADDRESS_HOME_COUNTRY, |
| 2973 ASCIIToUTF16(partially_supported_country)); |
| 2974 controller()->GetTestingManager()->AddTestingProfile(&verified_profile); |
| 2975 |
| 2976 EXPECT_FALSE(controller()->MenuModelForSection(SECTION_BILLING)); |
| 2977 } |
| 2978 |
2964 class AutofillDialogControllerI18nTest : public AutofillDialogControllerTest { | 2979 class AutofillDialogControllerI18nTest : public AutofillDialogControllerTest { |
2965 private: | 2980 private: |
2966 i18ninput::ScopedEnableForTesting enabled_; | 2981 i18ninput::ScopedEnableForTesting enabled_; |
2967 }; | 2982 }; |
2968 | 2983 |
2969 TEST_F(AutofillDialogControllerI18nTest, CountryChangeUpdatesSection) { | 2984 TEST_F(AutofillDialogControllerI18nTest, CountryChangeUpdatesSection) { |
2970 TestAutofillDialogView* view = controller()->GetView(); | 2985 TestAutofillDialogView* view = controller()->GetView(); |
2971 view->ClearSectionUpdates(); | 2986 view->ClearSectionUpdates(); |
2972 | 2987 |
2973 controller()->UserEditedOrActivatedInput(SECTION_SHIPPING, | 2988 controller()->UserEditedOrActivatedInput(SECTION_SHIPPING, |
(...skipping 27 matching lines...) Expand all Loading... |
3001 gfx::Rect(), | 3016 gfx::Rect(), |
3002 ASCIIToUTF16("Italy"), | 3017 ASCIIToUTF16("Italy"), |
3003 true); | 3018 true); |
3004 updates = view->section_updates(); | 3019 updates = view->section_updates(); |
3005 EXPECT_EQ(1U, updates[SECTION_BILLING]); | 3020 EXPECT_EQ(1U, updates[SECTION_BILLING]); |
3006 EXPECT_EQ(1U, updates.size()); | 3021 EXPECT_EQ(1U, updates.size()); |
3007 } | 3022 } |
3008 | 3023 |
3009 TEST_F(AutofillDialogControllerI18nTest, CorrectCountryFromInputs) { | 3024 TEST_F(AutofillDialogControllerI18nTest, CorrectCountryFromInputs) { |
3010 EXPECT_CALL(*controller()->GetMockValidator(), | 3025 EXPECT_CALL(*controller()->GetMockValidator(), |
3011 ValidateAddress(CountryCodeMatcher("CN"), _, _)); | 3026 ValidateAddress(CountryCodeMatcher("DE"), _, _)); |
3012 | 3027 |
3013 FieldValueMap billing_inputs; | 3028 FieldValueMap billing_inputs; |
3014 billing_inputs[ADDRESS_BILLING_COUNTRY] = ASCIIToUTF16("China"); | 3029 billing_inputs[ADDRESS_BILLING_COUNTRY] = ASCIIToUTF16("Germany"); |
3015 controller()->InputsAreValid(SECTION_BILLING, billing_inputs); | 3030 controller()->InputsAreValid(SECTION_BILLING, billing_inputs); |
3016 | 3031 |
3017 EXPECT_CALL(*controller()->GetMockValidator(), | 3032 EXPECT_CALL(*controller()->GetMockValidator(), |
3018 ValidateAddress(CountryCodeMatcher("FR"), _, _)); | 3033 ValidateAddress(CountryCodeMatcher("FR"), _, _)); |
3019 | 3034 |
3020 FieldValueMap shipping_inputs; | 3035 FieldValueMap shipping_inputs; |
3021 shipping_inputs[ADDRESS_HOME_COUNTRY] = ASCIIToUTF16("France"); | 3036 shipping_inputs[ADDRESS_HOME_COUNTRY] = ASCIIToUTF16("France"); |
3022 controller()->InputsAreValid(SECTION_SHIPPING, shipping_inputs); | 3037 controller()->InputsAreValid(SECTION_SHIPPING, shipping_inputs); |
3023 } | 3038 } |
3024 | 3039 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3090 // Profiles saved while rules are unavailable shouldn't be verified. | 3105 // Profiles saved while rules are unavailable shouldn't be verified. |
3091 const AutofillProfile& imported_profile = | 3106 const AutofillProfile& imported_profile = |
3092 controller()->GetTestingManager()->imported_profile(); | 3107 controller()->GetTestingManager()->imported_profile(); |
3093 ASSERT_EQ(imported_profile.GetRawInfo(NAME_FULL), | 3108 ASSERT_EQ(imported_profile.GetRawInfo(NAME_FULL), |
3094 full_profile.GetRawInfo(NAME_FULL)); | 3109 full_profile.GetRawInfo(NAME_FULL)); |
3095 EXPECT_EQ(imported_profile.origin(), GURL(kSourceUrl).GetOrigin().spec()); | 3110 EXPECT_EQ(imported_profile.origin(), GURL(kSourceUrl).GetOrigin().spec()); |
3096 EXPECT_FALSE(imported_profile.IsVerified()); | 3111 EXPECT_FALSE(imported_profile.IsVerified()); |
3097 } | 3112 } |
3098 | 3113 |
3099 } // namespace autofill | 3114 } // namespace autofill |
OLD | NEW |