summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-31 00:48:10 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-31 00:48:10 +0000
commited455379daa50edcefa37dd5670c12e84dce72f6 (patch)
treec817a2deb91307a573610c8bf505631d032273fc /app
parente5047ff99b92662f3e3bda31650b16506ae5ad55 (diff)
downloadchromium_src-ed455379daa50edcefa37dd5670c12e84dce72f6.zip
chromium_src-ed455379daa50edcefa37dd5670c12e84dce72f6.tar.gz
chromium_src-ed455379daa50edcefa37dd5670c12e84dce72f6.tar.bz2
base: Add UnSetEnv function to EnvVarGetter API.
BUG=None TEST=out/Debug/base_unittests --gtest_filter=EnvVarTest.UnSetEnvVar Signed-off-by: Thiago Farina <tfarina@chromium.org> Review URL: http://codereview.chromium.org/3043018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54418 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r--app/l10n_util_unittest.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/app/l10n_util_unittest.cc b/app/l10n_util_unittest.cc
index 1975d6c..58d0a98f 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");