OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/string16.h" | 7 #include "base/string16.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/autofill/autofill_country.h" | 9 #include "components/autofill/browser/autofill_country.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 // Test the constructor and accessors | 12 // Test the constructor and accessors |
13 TEST(AutofillCountryTest, AutofillCountry) { | 13 TEST(AutofillCountryTest, AutofillCountry) { |
14 AutofillCountry united_states_en("US", "en_US"); | 14 AutofillCountry united_states_en("US", "en_US"); |
15 EXPECT_EQ("US", united_states_en.country_code()); | 15 EXPECT_EQ("US", united_states_en.country_code()); |
16 EXPECT_EQ(ASCIIToUTF16("United States"), united_states_en.name()); | 16 EXPECT_EQ(ASCIIToUTF16("United States"), united_states_en.name()); |
17 EXPECT_EQ(ASCIIToUTF16("ZIP code"), united_states_en.postal_code_label()); | 17 EXPECT_EQ(ASCIIToUTF16("ZIP code"), united_states_en.postal_code_label()); |
18 EXPECT_EQ(ASCIIToUTF16("State"), united_states_en.state_label()); | 18 EXPECT_EQ(ASCIIToUTF16("State"), united_states_en.state_label()); |
19 | 19 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 EXPECT_EQ("DE", AutofillCountry::GetCountryCode(ASCIIToUTF16("duitsland"), | 77 EXPECT_EQ("DE", AutofillCountry::GetCountryCode(ASCIIToUTF16("duitsland"), |
78 "nl")); | 78 "nl")); |
79 | 79 |
80 // Should fall back to "en_US" locale if all else fails. | 80 // Should fall back to "en_US" locale if all else fails. |
81 EXPECT_EQ("US", AutofillCountry::GetCountryCode(ASCIIToUTF16("United States"), | 81 EXPECT_EQ("US", AutofillCountry::GetCountryCode(ASCIIToUTF16("United States"), |
82 "es")); | 82 "es")); |
83 EXPECT_EQ("US", AutofillCountry::GetCountryCode(ASCIIToUTF16("united states"), | 83 EXPECT_EQ("US", AutofillCountry::GetCountryCode(ASCIIToUTF16("united states"), |
84 "es")); | 84 "es")); |
85 EXPECT_EQ("US", AutofillCountry::GetCountryCode(ASCIIToUTF16("USA"), "es")); | 85 EXPECT_EQ("US", AutofillCountry::GetCountryCode(ASCIIToUTF16("USA"), "es")); |
86 } | 86 } |
OLD | NEW |