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

Unified Diff: app/l10n_util_unittest.cc

Issue 3043018: base: Add UnSetEnv function to EnvVarGetter API. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: Created 10 years, 5 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 | « no previous file | base/env_var.h » ('j') | base/env_var.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/l10n_util_unittest.cc
diff --git a/app/l10n_util_unittest.cc b/app/l10n_util_unittest.cc
index 1975d6cf7c63c5da99a38527802921034e14a3c8..58d0a98f9565db0bddf5bee30b88ebd8210b46d7 100644
--- a/app/l10n_util_unittest.cc
+++ b/app/l10n_util_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -15,6 +15,7 @@
#include "app/test/data/resource.h"
#endif
#include "base/basictypes.h"
+#include "base/env_var.h"
#include "base/file_util.h"
#include "base/path_service.h"
#include "base/stl_util-inl.h"
@@ -138,30 +139,32 @@ TEST_F(L10nUtilTest, GetAppLocale) {
icu::Locale locale = icu::Locale::getDefault();
#if defined(OS_POSIX) && !defined(OS_CHROMEOS)
+ scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create());
+
// Test the support of LANGUAGE environment variable.
SetICUDefaultLocale("en-US");
- ::setenv("LANGUAGE", "xx:fr_CA", 1);
+ env->SetEnv("LANGUAGE", "xx:fr_CA");
EXPECT_EQ("fr", l10n_util::GetApplicationLocale(L""));
- ::setenv("LANGUAGE", "xx:yy:en_gb.utf-8@quot", 1);
+ env->SetEnv("LANGUAGE", "xx:yy:en_gb.utf-8@quot");
EXPECT_EQ("en-GB", l10n_util::GetApplicationLocale(L""));
- ::setenv("LANGUAGE", "xx:zh-hk", 1);
+ env->SetEnv("LANGUAGE", "xx:zh-hk");
EXPECT_EQ("zh-TW", l10n_util::GetApplicationLocale(L""));
// We emulate gettext's behavior here, which ignores LANG/LC_MESSAGES/LC_ALL
// when LANGUAGE is specified. If no language specified in LANGUAGE is valid,
// then just fallback to the default language, which is en-US for us.
SetICUDefaultLocale("fr-FR");
- ::setenv("LANGUAGE", "xx:yy", 1);
+ env->SetEnv("LANGUAGE", "xx:yy");
EXPECT_EQ("en-US", l10n_util::GetApplicationLocale(L""));
- ::setenv("LANGUAGE", "/fr:zh_CN", 1);
+ env->SetEnv("LANGUAGE", "/fr:zh_CN");
EXPECT_EQ("zh-CN", l10n_util::GetApplicationLocale(L""));
// Make sure the follow tests won't be affected by LANGUAGE environment
// variable.
- ::unsetenv("LANGUAGE");
+ env->UnSetEnv("LANGUAGE");
#endif // defined(OS_POSIX) && !defined(OS_CHROMEOS)
SetICUDefaultLocale("en-US");
« no previous file with comments | « no previous file | base/env_var.h » ('j') | base/env_var.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698