Commit 6562db31 authored by Matthias Körber's avatar Matthias Körber Committed by Commit Bot

[Autofill] Fixed bug in localized country names cache

Change-Id: Ic1f755bb69a5f1313ed702906b673ed959942cc6
Bug: 1113955
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2340970Reviewed-by: default avatarChristoph Schwering <schwering@google.com>
Commit-Queue: Matthias Körber <koerber@google.com>
Cr-Commit-Position: refs/heads/master@{#795754}
parent 44727012
...@@ -130,7 +130,8 @@ const std::string CountryNames::GetCountryCodeForLocalizedCountryName( ...@@ -130,7 +130,8 @@ const std::string CountryNames::GetCountryCodeForLocalizedCountryName(
result = country_names_for_locale.GetCountryCode(country); result = country_names_for_locale.GetCountryCode(country);
// Put the country names for the locale into the cache. // Put the country names for the locale into the cache.
localized_country_names_cache_.Put(locale_name, std::move(result)); localized_country_names_cache_.Put(locale_name,
std::move(country_names_for_locale));
return result; return result;
} }
......
...@@ -72,6 +72,9 @@ TEST(CountryNamesTest, GetCountryCode_EnUsFallback) { ...@@ -72,6 +72,9 @@ TEST(CountryNamesTest, GetCountryCode_EnUsFallback) {
TEST(CountryNamesTest, GetCountryCodeForLocalizedCountryName) { TEST(CountryNamesTest, GetCountryCodeForLocalizedCountryName) {
// Initialize with the default locale. // Initialize with the default locale.
TestCountryNames names("en_US"); TestCountryNames names("en_US");
EXPECT_EQ("AM", names.GetCountryCodeForLocalizedCountryName(
ASCIIToUTF16("Armenien"), "de"));
// Check that there is no cache by requesting the same result twice.
EXPECT_EQ("AM", names.GetCountryCodeForLocalizedCountryName( EXPECT_EQ("AM", names.GetCountryCodeForLocalizedCountryName(
ASCIIToUTF16("Armenien"), "de")); ASCIIToUTF16("Armenien"), "de"));
EXPECT_EQ("AZ", names.GetCountryCodeForLocalizedCountryName( EXPECT_EQ("AZ", names.GetCountryCodeForLocalizedCountryName(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment