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

Side by Side Diff: chrome/browser/autofill/autofill_country_unittest.cc

Issue 6626070: Fix the settings page for es-419 locale: Spanish (Latin America). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed Created 9 years, 9 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
« no previous file with comments | « chrome/browser/autofill/autofill_country.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/autofill/autofill_country.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 20 matching lines...) Expand all
31 EXPECT_EQ("CA", canada_hu.country_code()); 31 EXPECT_EQ("CA", canada_hu.country_code());
32 EXPECT_EQ(ASCIIToUTF16("Kanada"), canada_hu.name()); 32 EXPECT_EQ(ASCIIToUTF16("Kanada"), canada_hu.name());
33 } 33 }
34 34
35 // Test locale to country code mapping. 35 // Test locale to country code mapping.
36 TEST(AutofillCountryTest, CountryCodeForLocale) { 36 TEST(AutofillCountryTest, CountryCodeForLocale) {
37 EXPECT_EQ("US", AutofillCountry::CountryCodeForLocale("en_US")); 37 EXPECT_EQ("US", AutofillCountry::CountryCodeForLocale("en_US"));
38 EXPECT_EQ("CA", AutofillCountry::CountryCodeForLocale("fr_CA")); 38 EXPECT_EQ("CA", AutofillCountry::CountryCodeForLocale("fr_CA"));
39 EXPECT_EQ("FR", AutofillCountry::CountryCodeForLocale("fr")); 39 EXPECT_EQ("FR", AutofillCountry::CountryCodeForLocale("fr"));
40 EXPECT_EQ("US", AutofillCountry::CountryCodeForLocale("Unknown")); 40 EXPECT_EQ("US", AutofillCountry::CountryCodeForLocale("Unknown"));
41 // "es-419" isn't associated with a country. See base/l10n/l10n_util.cc
42 // for details about this locale. Default to US.
43 EXPECT_EQ("US", AutofillCountry::CountryCodeForLocale("es-419"));
41 } 44 }
42 45
43 // Test mapping of localized country names to country codes. 46 // Test mapping of localized country names to country codes.
44 TEST(AutofillCountryTest, GetCountryCode) { 47 TEST(AutofillCountryTest, GetCountryCode) {
45 // Basic mapping 48 // Basic mapping
46 EXPECT_EQ("US", AutofillCountry::GetCountryCode(ASCIIToUTF16("United States"), 49 EXPECT_EQ("US", AutofillCountry::GetCountryCode(ASCIIToUTF16("United States"),
47 "en_US")); 50 "en_US"));
48 EXPECT_EQ("CA", AutofillCountry::GetCountryCode(ASCIIToUTF16("Canada"), 51 EXPECT_EQ("CA", AutofillCountry::GetCountryCode(ASCIIToUTF16("Canada"),
49 "en_US")); 52 "en_US"));
50 53
(...skipping 23 matching lines...) Expand all
74 EXPECT_EQ("DE", AutofillCountry::GetCountryCode(ASCIIToUTF16("duitsland"), 77 EXPECT_EQ("DE", AutofillCountry::GetCountryCode(ASCIIToUTF16("duitsland"),
75 "nl")); 78 "nl"));
76 79
77 // Should fall back to "en_US" locale if all else fails. 80 // Should fall back to "en_US" locale if all else fails.
78 EXPECT_EQ("US", AutofillCountry::GetCountryCode(ASCIIToUTF16("United States"), 81 EXPECT_EQ("US", AutofillCountry::GetCountryCode(ASCIIToUTF16("United States"),
79 "es")); 82 "es"));
80 EXPECT_EQ("US", AutofillCountry::GetCountryCode(ASCIIToUTF16("united states"), 83 EXPECT_EQ("US", AutofillCountry::GetCountryCode(ASCIIToUTF16("united states"),
81 "es")); 84 "es"));
82 EXPECT_EQ("US", AutofillCountry::GetCountryCode(ASCIIToUTF16("USA"), "es")); 85 EXPECT_EQ("US", AutofillCountry::GetCountryCode(ASCIIToUTF16("USA"), "es"));
83 } 86 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_country.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698