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

Unified Diff: chrome/installer/util/language_selector_unittest.cc

Issue 8488006: Add some language aliases to track changes to base/ui/l10n_util.cc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removed bad macau alias Created 9 years, 1 month 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/installer/util/language_selector.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/language_selector_unittest.cc
diff --git a/chrome/installer/util/language_selector_unittest.cc b/chrome/installer/util/language_selector_unittest.cc
index 1e5bc00b0fb36d3df91627eeea2dd953c97c9e73..2e9096f74de7b88eb7258960916abced816c433e 100644
--- a/chrome/installer/util/language_selector_unittest.cc
+++ b/chrome/installer/util/language_selector_unittest.cc
@@ -26,7 +26,7 @@ const wchar_t* const kExactMatchCandidates[] = {
const wchar_t* const kAliasMatchCandidates[] = {
#if defined(GOOGLE_CHROME_BUILD)
L"he", L"nb", L"tl", L"zh-chs", L"zh-cht", L"zh-hans", L"zh-hant", L"zh-hk",
- L"zh-mk", L"zh-mo"
+ L"zh-mo"
#else
// There is only en-us.
L"en-us"
@@ -126,3 +126,64 @@ INSTANTIATE_TEST_CASE_P(
::testing::ValuesIn(
&kWildcardMatchCandidates[0],
&kWildcardMatchCandidates[arraysize(kWildcardMatchCandidates)]));
+
+#if defined(GOOGLE_CHROME_BUILD)
+
+// A fixture for testing aliases that match to an expected translation. The
+// first member of the tuple is the expected translation, the second is a
+// candidate that should be aliased to the expectation.
+class LanguageSelectorAliasTest
+ : public ::testing::TestWithParam< std::tr1::tuple<const wchar_t*,
+ const wchar_t*> > {
+};
+
+// Test that the candidate language maps to the aliased translation.
+TEST_P(LanguageSelectorAliasTest, AliasesMatch) {
+ installer::LanguageSelector instance(
+ std::vector<std::wstring>(1, std::tr1::get<1>(GetParam())));
+ EXPECT_EQ(std::tr1::get<0>(GetParam()), instance.selected_translation());
+}
+
+INSTANTIATE_TEST_CASE_P(
+ EnGbAliases,
+ LanguageSelectorAliasTest,
+ ::testing::Combine(
+ ::testing::Values(L"en-gb"),
+ ::testing::Values(L"en-au", L"en-ca", L"en-nz", L"en-za")));
+
+INSTANTIATE_TEST_CASE_P(
+ IwAliases,
+ LanguageSelectorAliasTest,
+ ::testing::Combine(
+ ::testing::Values(L"iw"),
+ ::testing::Values(L"he")));
+
+INSTANTIATE_TEST_CASE_P(
+ NoAliases,
+ LanguageSelectorAliasTest,
+ ::testing::Combine(
+ ::testing::Values(L"no"),
+ ::testing::Values(L"nb")));
+
+INSTANTIATE_TEST_CASE_P(
+ FilAliases,
+ LanguageSelectorAliasTest,
+ ::testing::Combine(
+ ::testing::Values(L"fil"),
+ ::testing::Values(L"tl")));
+
+INSTANTIATE_TEST_CASE_P(
+ ZhCnAliases,
+ LanguageSelectorAliasTest,
+ ::testing::Combine(
+ ::testing::Values(L"zh-cn"),
+ ::testing::Values(L"zh-chs", L"zh-hans", L"zh-sg")));
+
+INSTANTIATE_TEST_CASE_P(
+ ZhTwAliases,
+ LanguageSelectorAliasTest,
+ ::testing::Combine(
+ ::testing::Values(L"zh-tw"),
+ ::testing::Values(L"zh-cht", L"zh-hant", L"zh-hk", L"zh-mo")));
+
+#endif // GOOGLE_CHROME_BUILD
« no previous file with comments | « chrome/installer/util/language_selector.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698