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

Unified Diff: chrome/browser/ui/webui/chromeos/login/l10n_util_unittest.cc

Issue 483523005: Default to current UI locale when recommended locales are invalid (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit tests, for real this time. Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/l10n_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/chromeos/login/l10n_util_unittest.cc
diff --git a/chrome/browser/ui/webui/chromeos/login/l10n_util_unittest.cc b/chrome/browser/ui/webui/chromeos/login/l10n_util_unittest.cc
index 86e3d922a1c91c03465558d6eb0b0441ed9eea70..6e9be46d3ceb11c53868a9e202b0d1ddc68fac8b 100644
--- a/chrome/browser/ui/webui/chromeos/login/l10n_util_unittest.cc
+++ b/chrome/browser/ui/webui/chromeos/login/l10n_util_unittest.cc
@@ -129,6 +129,39 @@ TEST_F(L10nUtilTest, GetUILanguageList) {
VerifyOnlyUILanguages(*list);
}
+TEST_F(L10nUtilTest, FindMostRelevantLocale) {
+ base::ListValue available_locales;
+ scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
+ dict->SetString("value", "de");
+ available_locales.Append(dict.release());
+ dict.reset(new base::DictionaryValue);
+ dict->SetString("value", "fr");
+ available_locales.Append(dict.release());
+ dict.reset(new base::DictionaryValue);
+ dict->SetString("value", "en-GB");
+ available_locales.Append(dict.release());
+
+ std::vector<std::string> most_relevant_language_codes;
+ EXPECT_EQ("en-US", FindMostRelevantLocale(most_relevant_language_codes,
+ available_locales,
+ "en-US"));
+
+ most_relevant_language_codes.push_back("xx");
+ EXPECT_EQ("en-US", FindMostRelevantLocale(most_relevant_language_codes,
+ available_locales,
+ "en-US"));
+
+ most_relevant_language_codes.push_back("fr");
+ EXPECT_EQ("fr", FindMostRelevantLocale(most_relevant_language_codes,
+ available_locales,
+ "en-US"));
+
+ most_relevant_language_codes.push_back("de");
+ EXPECT_EQ("fr", FindMostRelevantLocale(most_relevant_language_codes,
+ available_locales,
+ "en-US"));
+}
+
void InitStartupCustomizationDocumentForTesting(const std::string& manifest) {
StartupCustomizationDocument::GetInstance()->LoadManifestFromString(manifest);
StartupCustomizationDocument::GetInstance()->Init(
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/l10n_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698