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

Side by Side Diff: app/l10n_util_unittest.cc

Issue 3823002: Move windows version-related stuff out of base/win_util and into base/win/win... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 2 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
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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_POSIX) && !defined(OS_MACOSX) 7 #if defined(OS_POSIX) && !defined(OS_MACOSX)
8 #include <cstdlib> 8 #include <cstdlib>
9 #endif 9 #endif
10 10
11 #include "app/app_paths.h" 11 #include "app/app_paths.h"
12 #include "app/l10n_util.h" 12 #include "app/l10n_util.h"
13 #include "app/l10n_util_collator.h" 13 #include "app/l10n_util_collator.h"
14 #if !defined(OS_MACOSX) 14 #if !defined(OS_MACOSX)
15 #include "app/test/data/resource.h" 15 #include "app/test/data/resource.h"
16 #endif 16 #endif
17 #include "base/basictypes.h" 17 #include "base/basictypes.h"
18 #include "base/environment.h" 18 #include "base/environment.h"
19 #include "base/file_util.h" 19 #include "base/file_util.h"
20 #include "base/path_service.h" 20 #include "base/path_service.h"
21 #include "base/stl_util-inl.h" 21 #include "base/stl_util-inl.h"
22 #include "base/string_util.h" 22 #include "base/string_util.h"
23 #include "base/utf_string_conversions.h" 23 #include "base/utf_string_conversions.h"
24 #if defined(OS_WIN) 24 #if defined(OS_WIN)
25 #include "base/win_util.h" 25 #include "base/win/windows_version.h"
26 #endif 26 #endif
27 #include "testing/gtest/include/gtest/gtest.h" 27 #include "testing/gtest/include/gtest/gtest.h"
28 #include "testing/platform_test.h" 28 #include "testing/platform_test.h"
29 #include "unicode/locid.h" 29 #include "unicode/locid.h"
30 30
31 namespace { 31 namespace {
32 32
33 class StringWrapper { 33 class StringWrapper {
34 public: 34 public:
35 explicit StringWrapper(const std::wstring& string) : string_(string) {} 35 explicit StringWrapper(const std::wstring& string) : string_(string) {}
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 SetICUDefaultLocale("es-AR"); 232 SetICUDefaultLocale("es-AR");
233 EXPECT_EQ("es", l10n_util::GetApplicationLocale("es")); 233 EXPECT_EQ("es", l10n_util::GetApplicationLocale("es"));
234 234
235 SetICUDefaultLocale("zh-HK"); 235 SetICUDefaultLocale("zh-HK");
236 EXPECT_EQ("zh-CN", l10n_util::GetApplicationLocale("zh-CN")); 236 EXPECT_EQ("zh-CN", l10n_util::GetApplicationLocale("zh-CN"));
237 237
238 SetICUDefaultLocale("he"); 238 SetICUDefaultLocale("he");
239 EXPECT_EQ("en-US", l10n_util::GetApplicationLocale("en")); 239 EXPECT_EQ("en-US", l10n_util::GetApplicationLocale("en"));
240 240
241 // Amharic should be blocked unless OS is Vista or newer. 241 // Amharic should be blocked unless OS is Vista or newer.
242 if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA) { 242 if (base::win::GetVersion() < base::win::VERSION_VISTA) {
243 SetICUDefaultLocale("am"); 243 SetICUDefaultLocale("am");
244 EXPECT_EQ("en-US", l10n_util::GetApplicationLocale("")); 244 EXPECT_EQ("en-US", l10n_util::GetApplicationLocale(""));
245 SetICUDefaultLocale("en-GB"); 245 SetICUDefaultLocale("en-GB");
246 EXPECT_EQ("en-GB", l10n_util::GetApplicationLocale("am")); 246 EXPECT_EQ("en-GB", l10n_util::GetApplicationLocale("am"));
247 } else { 247 } else {
248 SetICUDefaultLocale("am"); 248 SetICUDefaultLocale("am");
249 EXPECT_EQ("am", l10n_util::GetApplicationLocale("")); 249 EXPECT_EQ("am", l10n_util::GetApplicationLocale(""));
250 SetICUDefaultLocale("en-GB"); 250 SetICUDefaultLocale("en-GB");
251 EXPECT_EQ("am", l10n_util::GetApplicationLocale("am")); 251 EXPECT_EQ("am", l10n_util::GetApplicationLocale("am"));
252 } 252 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 295
296 result = l10n_util::GetDisplayNameForLocale("zh-TW", "en", false); 296 result = l10n_util::GetDisplayNameForLocale("zh-TW", "en", false);
297 EXPECT_EQ(result, ASCIIToUTF16("Chinese (Traditional Han)")); 297 EXPECT_EQ(result, ASCIIToUTF16("Chinese (Traditional Han)"));
298 298
299 result = l10n_util::GetDisplayNameForLocale("pt-BR", "en", false); 299 result = l10n_util::GetDisplayNameForLocale("pt-BR", "en", false);
300 EXPECT_EQ(result, ASCIIToUTF16("Portuguese (Brazil)")); 300 EXPECT_EQ(result, ASCIIToUTF16("Portuguese (Brazil)"));
301 301
302 result = l10n_util::GetDisplayNameForLocale("es-419", "en", false); 302 result = l10n_util::GetDisplayNameForLocale("es-419", "en", false);
303 EXPECT_EQ(result, ASCIIToUTF16("Spanish (Latin America and the Caribbean)")); 303 EXPECT_EQ(result, ASCIIToUTF16("Spanish (Latin America and the Caribbean)"));
304 } 304 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698