summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-05 23:12:56 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-05 23:12:56 +0000
commit705800aed2989c63913a76750d28c25932aa6f46 (patch)
tree346f09cb4f66440cbd94566eff3a5abf708299ca
parent0ea87f1ffde023f910d6b64450283aebf312092b (diff)
downloadchromium_src-705800aed2989c63913a76750d28c25932aa6f46.zip
chromium_src-705800aed2989c63913a76750d28c25932aa6f46.tar.gz
chromium_src-705800aed2989c63913a76750d28c25932aa6f46.tar.bz2
base: Get rid of the deprecated SysInfo::HasEnvVar.
Use the new EnvVarGetter::HasEnv instead. BUG=None TEST=trybots Review URL: http://codereview.chromium.org/2819042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51648 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/sys_info.h4
-rw-r--r--base/sys_info_posix.cc8
-rw-r--r--base/sys_info_unittest.cc7
-rw-r--r--base/sys_info_win.cc7
-rw-r--r--webkit/tools/test_shell/test_shell_main.cc6
5 files changed, 7 insertions, 25 deletions
diff --git a/base/sys_info.h b/base/sys_info.h
index 0f27aa7..cefce13 100644
--- a/base/sys_info.h
+++ b/base/sys_info.h
@@ -30,10 +30,6 @@ class SysInfo {
// or -1 on failure.
static int64 AmountOfFreeDiskSpace(const FilePath& path);
- // Return true if the given environment variable is defined.
- // DEPRECATED in favor of EnvVarGetter in base/env_var.h.
- static bool HasEnvVar(const wchar_t* var);
-
// Return the value of the given environment variable
// or an empty string if not defined.
// DEPRECATED in favor of EnvVarGetter in base/env_var.h.
diff --git a/base/sys_info_posix.cc b/base/sys_info_posix.cc
index b2526ba..f2d75d2 100644
--- a/base/sys_info_posix.cc
+++ b/base/sys_info_posix.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 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.
@@ -47,12 +47,6 @@ int64 SysInfo::AmountOfFreeDiskSpace(const FilePath& path) {
}
// static
-bool SysInfo::HasEnvVar(const wchar_t* var) {
- std::string var_utf8 = WideToUTF8(std::wstring(var));
- return getenv(var_utf8.c_str()) != NULL;
-}
-
-// static
std::wstring SysInfo::GetEnvVar(const wchar_t* var) {
std::string var_utf8 = WideToUTF8(std::wstring(var));
char* value = getenv(var_utf8.c_str());
diff --git a/base/sys_info_unittest.cc b/base/sys_info_unittest.cc
index 4339b6a..79f172d 100644
--- a/base/sys_info_unittest.cc
+++ b/base/sys_info_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 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.
@@ -33,11 +33,6 @@ TEST_F(SysInfoTest, GetEnvVar) {
EXPECT_NE(base::SysInfo::GetEnvVar(L"PATH"), L"");
}
-TEST_F(SysInfoTest, HasEnvVar) {
- // Every setup should have PATH...
- EXPECT_TRUE(base::SysInfo::HasEnvVar(L"PATH"));
-}
-
#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS)
TEST_F(SysInfoTest, OperatingSystemVersionNumbers) {
int32 os_major_version = -1;
diff --git a/base/sys_info_win.cc b/base/sys_info_win.cc
index ebb95c7ba..35a7878 100644
--- a/base/sys_info_win.cc
+++ b/base/sys_info_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 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.
@@ -48,11 +48,6 @@ int64 SysInfo::AmountOfFreeDiskSpace(const FilePath& path) {
}
// static
-bool SysInfo::HasEnvVar(const wchar_t* var) {
- return GetEnvironmentVariable(var, NULL, 0) != 0;
-}
-
-// static
std::wstring SysInfo::GetEnvVar(const wchar_t* var) {
DWORD value_length = GetEnvironmentVariable(var, NULL, 0);
if (value_length == 0) {
diff --git a/webkit/tools/test_shell/test_shell_main.cc b/webkit/tools/test_shell/test_shell_main.cc
index 41de061..412cd3a 100644
--- a/webkit/tools/test_shell/test_shell_main.cc
+++ b/webkit/tools/test_shell/test_shell_main.cc
@@ -1,10 +1,11 @@
-// 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.
#include "base/at_exit.h"
#include "base/basictypes.h"
#include "base/command_line.h"
+#include "base/env_var.h"
#include "base/event_recorder.h"
#include "base/file_path.h"
#include "base/file_util.h"
@@ -90,8 +91,9 @@ int main(int argc, char* argv[]) {
// directly, its constructor sets up some necessary state.
MessageLoopForUI main_message_loop;
+ scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create());
bool suppress_error_dialogs = (
- base::SysInfo::HasEnvVar(L"CHROME_HEADLESS") ||
+ env->HasEnv("CHROME_HEADLESS") ||
parsed_command_line.HasSwitch(test_shell::kNoErrorDialogs) ||
parsed_command_line.HasSwitch(test_shell::kLayoutTests));
bool layout_test_mode =