| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "components/autofill/core/browser/autofill_country.h" | 9 #include "components/autofill/core/browser/autofill_country.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 using base::ASCIIToUTF16; |
| 13 |
| 12 namespace autofill { | 14 namespace autofill { |
| 13 | 15 |
| 14 // Test the constructor and accessors | 16 // Test the constructor and accessors |
| 15 TEST(AutofillCountryTest, AutofillCountry) { | 17 TEST(AutofillCountryTest, AutofillCountry) { |
| 16 AutofillCountry united_states_en("US", "en_US"); | 18 AutofillCountry united_states_en("US", "en_US"); |
| 17 EXPECT_EQ("US", united_states_en.country_code()); | 19 EXPECT_EQ("US", united_states_en.country_code()); |
| 18 EXPECT_EQ(ASCIIToUTF16("United States"), united_states_en.name()); | 20 EXPECT_EQ(ASCIIToUTF16("United States"), united_states_en.name()); |
| 19 EXPECT_EQ(ASCIIToUTF16("ZIP code"), united_states_en.postal_code_label()); | 21 EXPECT_EQ(ASCIIToUTF16("ZIP code"), united_states_en.postal_code_label()); |
| 20 EXPECT_EQ(ASCIIToUTF16("State"), united_states_en.state_label()); | 22 EXPECT_EQ(ASCIIToUTF16("State"), united_states_en.state_label()); |
| 21 | 23 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 83 |
| 82 // Should fall back to "en_US" locale if all else fails. | 84 // Should fall back to "en_US" locale if all else fails. |
| 83 EXPECT_EQ("US", AutofillCountry::GetCountryCode(ASCIIToUTF16("United States"), | 85 EXPECT_EQ("US", AutofillCountry::GetCountryCode(ASCIIToUTF16("United States"), |
| 84 "es")); | 86 "es")); |
| 85 EXPECT_EQ("US", AutofillCountry::GetCountryCode(ASCIIToUTF16("united states"), | 87 EXPECT_EQ("US", AutofillCountry::GetCountryCode(ASCIIToUTF16("united states"), |
| 86 "es")); | 88 "es")); |
| 87 EXPECT_EQ("US", AutofillCountry::GetCountryCode(ASCIIToUTF16("USA"), "es")); | 89 EXPECT_EQ("US", AutofillCountry::GetCountryCode(ASCIIToUTF16("USA"), "es")); |
| 88 } | 90 } |
| 89 | 91 |
| 90 } // namespace autofill | 92 } // namespace autofill |
| OLD | NEW |