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

Side by Side Diff: app/l10n_util_unittest.cc

Issue 3052034: base: Rename EnvVarGetter to Environment. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: review Created 10 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 unified diff | Download patch
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/env_var.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 #if defined(OS_WIN) 23 #if defined(OS_WIN)
24 #include "base/win_util.h" 24 #include "base/win_util.h"
25 #endif 25 #endif
26 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
27 #include "testing/platform_test.h" 27 #include "testing/platform_test.h"
28 #include "unicode/locid.h" 28 #include "unicode/locid.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 for (size_t i = 0; i < arraysize(filenames); ++i) { 132 for (size_t i = 0; i < arraysize(filenames); ++i) {
133 FilePath filename = new_locale_dir.AppendASCII( 133 FilePath filename = new_locale_dir.AppendASCII(
134 filenames[i] + kLocaleFileExtension); 134 filenames[i] + kLocaleFileExtension);
135 file_util::WriteFile(filename, "", 0); 135 file_util::WriteFile(filename, "", 0);
136 } 136 }
137 137
138 // Keep a copy of ICU's default locale before we overwrite it. 138 // Keep a copy of ICU's default locale before we overwrite it.
139 icu::Locale locale = icu::Locale::getDefault(); 139 icu::Locale locale = icu::Locale::getDefault();
140 140
141 #if defined(OS_POSIX) && !defined(OS_CHROMEOS) 141 #if defined(OS_POSIX) && !defined(OS_CHROMEOS)
142 scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); 142 scoped_ptr<base::Environment> env(base::Environment::Create());
143 143
144 // Test the support of LANGUAGE environment variable. 144 // Test the support of LANGUAGE environment variable.
145 SetICUDefaultLocale("en-US"); 145 SetICUDefaultLocale("en-US");
146 env->SetEnv("LANGUAGE", "xx:fr_CA"); 146 env->SetEnv("LANGUAGE", "xx:fr_CA");
147 EXPECT_EQ("fr", l10n_util::GetApplicationLocale(L"")); 147 EXPECT_EQ("fr", l10n_util::GetApplicationLocale(L""));
148 148
149 env->SetEnv("LANGUAGE", "xx:yy:en_gb.utf-8@quot"); 149 env->SetEnv("LANGUAGE", "xx:yy:en_gb.utf-8@quot");
150 EXPECT_EQ("en-GB", l10n_util::GetApplicationLocale(L"")); 150 EXPECT_EQ("en-GB", l10n_util::GetApplicationLocale(L""));
151 151
152 env->SetEnv("LANGUAGE", "xx:zh-hk"); 152 env->SetEnv("LANGUAGE", "xx:zh-hk");
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 294
295 result = l10n_util::GetDisplayNameForLocale("zh-TW", "en", false); 295 result = l10n_util::GetDisplayNameForLocale("zh-TW", "en", false);
296 EXPECT_EQ(result, ASCIIToUTF16("Chinese (Traditional Han)")); 296 EXPECT_EQ(result, ASCIIToUTF16("Chinese (Traditional Han)"));
297 297
298 result = l10n_util::GetDisplayNameForLocale("pt-BR", "en", false); 298 result = l10n_util::GetDisplayNameForLocale("pt-BR", "en", false);
299 EXPECT_EQ(result, ASCIIToUTF16("Portuguese (Brazil)")); 299 EXPECT_EQ(result, ASCIIToUTF16("Portuguese (Brazil)"));
300 300
301 result = l10n_util::GetDisplayNameForLocale("es-419", "en", false); 301 result = l10n_util::GetDisplayNameForLocale("es-419", "en", false);
302 EXPECT_EQ(result, ASCIIToUTF16("Spanish (Latin America and the Caribbean)")); 302 EXPECT_EQ(result, ASCIIToUTF16("Spanish (Latin America and the Caribbean)"));
303 } 303 }
OLDNEW
« no previous file with comments | « app/gtk_util.cc ('k') | base/base.gyp » ('j') | base/environment.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698