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

Side by Side 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: comment tweak 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include <vector> 6 #include <vector>
7 7
8 #include "chrome/installer/util/language_selector.h" 8 #include "chrome/installer/util/language_selector.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 &kAliasMatchCandidates[0], 119 &kAliasMatchCandidates[0],
120 &kAliasMatchCandidates[arraysize(kAliasMatchCandidates)])); 120 &kAliasMatchCandidates[arraysize(kAliasMatchCandidates)]));
121 121
122 // Test a few wildcard matches. 122 // Test a few wildcard matches.
123 INSTANTIATE_TEST_CASE_P( 123 INSTANTIATE_TEST_CASE_P(
124 TestWildcardMatches, 124 TestWildcardMatches,
125 LanguageSelectorMatchCandidateTest, 125 LanguageSelectorMatchCandidateTest,
126 ::testing::ValuesIn( 126 ::testing::ValuesIn(
127 &kWildcardMatchCandidates[0], 127 &kWildcardMatchCandidates[0],
128 &kWildcardMatchCandidates[arraysize(kWildcardMatchCandidates)])); 128 &kWildcardMatchCandidates[arraysize(kWildcardMatchCandidates)]));
129
130 // A fixture for testing aliases that match to an expected translation. The
131 // first member of the tuple is the expected translation, the second is a
132 // candidate that should be aliased to the expectation.
133 class LanguageSelectorAliasTest
134 : public ::testing::TestWithParam< std::tr1::tuple<const wchar_t*,
135 const wchar_t*> > {
136 };
137
138 // Test that the candidate language maps to the aliased translation.
139 TEST_P(LanguageSelectorAliasTest, AliasesMatch) {
140 installer::LanguageSelector instance(
141 std::vector<std::wstring>(1, std::tr1::get<1>(GetParam())));
142 EXPECT_EQ(std::tr1::get<0>(GetParam()), instance.selected_translation());
143 }
144
145 INSTANTIATE_TEST_CASE_P(
146 EnGbAliases,
147 LanguageSelectorAliasTest,
148 ::testing::Combine(
149 ::testing::Values(L"en-gb"),
150 ::testing::Values(L"en-au", L"en-ca", L"en-nz", L"en-za")));
151
152 INSTANTIATE_TEST_CASE_P(
153 IwAliases,
154 LanguageSelectorAliasTest,
155 ::testing::Combine(
156 ::testing::Values(L"iw"),
157 ::testing::Values(L"he")));
158
159 INSTANTIATE_TEST_CASE_P(
160 NoAliases,
161 LanguageSelectorAliasTest,
162 ::testing::Combine(
163 ::testing::Values(L"no"),
164 ::testing::Values(L"nb")));
165
166 INSTANTIATE_TEST_CASE_P(
167 FilAliases,
168 LanguageSelectorAliasTest,
169 ::testing::Combine(
170 ::testing::Values(L"fil"),
171 ::testing::Values(L"tl")));
172
173 INSTANTIATE_TEST_CASE_P(
174 ZhCnAliases,
175 LanguageSelectorAliasTest,
176 ::testing::Combine(
177 ::testing::Values(L"zh-cn"),
178 ::testing::Values(L"zh-chs", L"zh-hans", L"zh-sg")));
179
180 INSTANTIATE_TEST_CASE_P(
181 ZhTwAliases,
182 LanguageSelectorAliasTest,
183 ::testing::Combine(
184 ::testing::Values(L"zh-tw"),
185 ::testing::Values(L"zh-cht", L"zh-hant", L"zh-hk", L"zh-mk",
jungshik at Google 2011/11/29 23:30:37 MK is for Macedonia. So, it should be dropped.
grt (UTC plus 2) 2011/12/01 14:31:11 Done.
186 L"zh-mo")));
OLDNEW
« chrome/installer/util/language_selector.cc ('K') | « chrome/installer/util/language_selector.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698