diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-04 23:43:20 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-04 23:43:20 +0000 |
commit | 9432ade948544ddd1c0c982cc1201e06061e8bb3 (patch) | |
tree | 9c9c40c596e199cc738b2e09ad074f03f2e1b8c4 | |
parent | 3a77e46f0b4616c4f2a33b76cdb0de75dfb8a5d5 (diff) | |
download | chromium_src-9432ade948544ddd1c0c982cc1201e06061e8bb3.zip chromium_src-9432ade948544ddd1c0c982cc1201e06061e8bb3.tar.gz chromium_src-9432ade948544ddd1c0c982cc1201e06061e8bb3.tar.bz2 |
base: rename Environment::HasEnv to Environment::HasVar.
This is the part 2 of this series. More two comming. Splitting this
into small parts, so it is more easy to review and reduce the size of the CL.
BUG=None
TEST=trybots
Review URL: http://codereview.chromium.org/3035050
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54996 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/environment.cc | 2 | ||||
-rw-r--r-- | base/environment.h | 2 | ||||
-rw-r--r-- | base/environment_unittest.cc | 10 | ||||
-rw-r--r-- | base/nss_util.cc | 2 | ||||
-rw-r--r-- | base/xdg_util.cc | 8 | ||||
-rw-r--r-- | chrome/browser/renderer_host/audio_renderer_host_unittest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/protocol_manager.cc | 2 | ||||
-rw-r--r-- | chrome/common/logging_chrome.cc | 4 | ||||
-rw-r--r-- | chrome/common/process_watcher_win.cc | 2 | ||||
-rw-r--r-- | chrome/test/automated_ui_tests/automated_ui_tests.cc | 2 | ||||
-rw-r--r-- | chrome/test/ui/ui_test_suite.cc | 2 | ||||
-rw-r--r-- | media/audio/audio_output_controller_unittest.cc | 2 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_main.cc | 2 |
13 files changed, 21 insertions, 21 deletions
diff --git a/base/environment.cc b/base/environment.cc index 1ec890d..4ff6a74 100644 --- a/base/environment.cc +++ b/base/environment.cc @@ -119,7 +119,7 @@ Environment* Environment::Create() { return new EnvironmentImpl(); } -bool Environment::HasEnv(const char* variable_name) { +bool Environment::HasVar(const char* variable_name) { return GetEnv(variable_name, NULL); } diff --git a/base/environment.h b/base/environment.h index fa8f197..4e2a6e7 100644 --- a/base/environment.h +++ b/base/environment.h @@ -33,7 +33,7 @@ class Environment { virtual bool GetEnv(const char* variable_name, std::string* result) = 0; // Syntactic sugar for GetEnv(variable_name, NULL); - virtual bool HasEnv(const char* variable_name); + virtual bool HasVar(const char* variable_name); // Returns true on success, otherwise returns false. virtual bool SetEnv(const char* variable_name, diff --git a/base/environment_unittest.cc b/base/environment_unittest.cc index f37b682..302a0d0 100644 --- a/base/environment_unittest.cc +++ b/base/environment_unittest.cc @@ -17,10 +17,10 @@ TEST_F(EnvironmentTest, GetEnvVar) { EXPECT_NE(env_value, ""); } -TEST_F(EnvironmentTest, HasEnvVar) { +TEST_F(EnvironmentTest, HasVar) { // Every setup should have PATH... scoped_ptr<base::Environment> env(base::Environment::Create()); - EXPECT_TRUE(env->HasEnv("PATH")); + EXPECT_TRUE(env->HasVar("PATH")); } TEST_F(EnvironmentTest, SetEnvVar) { @@ -31,7 +31,7 @@ TEST_F(EnvironmentTest, SetEnvVar) { EXPECT_TRUE(env->SetEnv(kFooUpper, kFooLower)); // Now verify that the environment has the new variable. - EXPECT_TRUE(env->HasEnv(kFooUpper)); + EXPECT_TRUE(env->HasVar(kFooUpper)); std::string var_value; EXPECT_TRUE(env->GetEnv(kFooUpper, &var_value)); @@ -47,11 +47,11 @@ TEST_F(EnvironmentTest, UnSetVar) { EXPECT_TRUE(env->SetEnv(kFooUpper, kFooLower)); // Now verify that the environment has the new variable. - EXPECT_TRUE(env->HasEnv(kFooUpper)); + EXPECT_TRUE(env->HasVar(kFooUpper)); // Finally verify that the environment variable was erased. EXPECT_TRUE(env->UnSetVar(kFooUpper)); // And check that the variable has been unset. - EXPECT_FALSE(env->HasEnv(kFooUpper)); + EXPECT_FALSE(env->HasVar(kFooUpper)); } diff --git a/base/nss_util.cc b/base/nss_util.cc index 0d7ec07..ac6752e 100644 --- a/base/nss_util.cc +++ b/base/nss_util.cc @@ -82,7 +82,7 @@ void UseLocalCacheOfNSSDatabaseIfNFS(const FilePath& database_dir) { if (buf.f_type == NFS_SUPER_MAGIC) { scoped_ptr<base::Environment> env(base::Environment::Create()); const char* use_cache_env_var = "NSS_SDB_USE_CACHE"; - if (!env->HasEnv(use_cache_env_var)) + if (!env->HasVar(use_cache_env_var)) env->SetEnv(use_cache_env_var, "yes"); } } diff --git a/base/xdg_util.cc b/base/xdg_util.cc index 426ef0e..6978986 100644 --- a/base/xdg_util.cc +++ b/base/xdg_util.cc @@ -39,7 +39,7 @@ DesktopEnvironment GetDesktopEnvironment(Environment* env) { return DESKTOP_ENVIRONMENT_KDE4; } else if (desktop_session == "kde") { // This may mean KDE4 on newer systems, so we have to check. - if (env->HasEnv("KDE_SESSION_VERSION")) + if (env->HasVar("KDE_SESSION_VERSION")) return DESKTOP_ENVIRONMENT_KDE4; return DESKTOP_ENVIRONMENT_KDE3; } else if (desktop_session.find("xfce") != std::string::npos) { @@ -49,10 +49,10 @@ DesktopEnvironment GetDesktopEnvironment(Environment* env) { // Fall back on some older environment variables. // Useful particularly in the DESKTOP_SESSION=default case. - if (env->HasEnv("GNOME_DESKTOP_SESSION_ID")) { + if (env->HasVar("GNOME_DESKTOP_SESSION_ID")) { return DESKTOP_ENVIRONMENT_GNOME; - } else if (env->HasEnv("KDE_FULL_SESSION")) { - if (env->HasEnv("KDE_SESSION_VERSION")) + } else if (env->HasVar("KDE_FULL_SESSION")) { + if (env->HasVar("KDE_SESSION_VERSION")) return DESKTOP_ENVIRONMENT_KDE4; return DESKTOP_ENVIRONMENT_KDE3; } diff --git a/chrome/browser/renderer_host/audio_renderer_host_unittest.cc b/chrome/browser/renderer_host/audio_renderer_host_unittest.cc index 6a428d4..f86cbdc 100644 --- a/chrome/browser/renderer_host/audio_renderer_host_unittest.cc +++ b/chrome/browser/renderer_host/audio_renderer_host_unittest.cc @@ -30,7 +30,7 @@ static const int kStreamId = 50; static bool IsRunningHeadless() { scoped_ptr<base::Environment> env(base::Environment::Create()); - if (env->HasEnv("CHROME_HEADLESS")) + if (env->HasVar("CHROME_HEADLESS")) return true; return false; } diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc index 886c805..732b416 100644 --- a/chrome/browser/safe_browsing/protocol_manager.cc +++ b/chrome/browser/safe_browsing/protocol_manager.cc @@ -419,7 +419,7 @@ bool SafeBrowsingProtocolManager::HandleServiceResponse(const GURL& url, void SafeBrowsingProtocolManager::Initialize() { // Don't want to hit the safe browsing servers on build/chrome bots. scoped_ptr<base::Environment> env(base::Environment::Create()); - if (env->HasEnv(env_vars::kHeadless)) + if (env->HasVar(env_vars::kHeadless)) return; ScheduleNextUpdate(false /* no back off */); diff --git a/chrome/common/logging_chrome.cc b/chrome/common/logging_chrome.cc index 0869a09..10795caf 100644 --- a/chrome/common/logging_chrome.cc +++ b/chrome/common/logging_chrome.cc @@ -205,7 +205,7 @@ void InitChromeLogging(const CommandLine& command_line, // Variable or by the Command Line Switch. This is for // automated test purposes. scoped_ptr<base::Environment> env(base::Environment::Create()); - if (env->HasEnv(env_vars::kHeadless) || + if (env->HasVar(env_vars::kHeadless) || command_line.HasSwitch(switches::kNoErrorDialogs)) SuppressDialogs(); @@ -227,7 +227,7 @@ void InitChromeLogging(const CommandLine& command_line, #if defined(OS_WIN) // Enable trace control and transport through event tracing for Windows. - if (env->HasEnv(env_vars::kEtwLogging)) + if (env->HasVar(env_vars::kEtwLogging)) logging::LogEventProvider::Initialize(kChromeTraceProviderName); #endif diff --git a/chrome/common/process_watcher_win.cc b/chrome/common/process_watcher_win.cc index 8f37d3f..210b3d5 100644 --- a/chrome/common/process_watcher_win.cc +++ b/chrome/common/process_watcher_win.cc @@ -50,7 +50,7 @@ class TimerExpiredTask : public Task, public base::ObjectWatcher::Delegate { private: void KillProcess() { scoped_ptr<base::Environment> env(base::Environment::Create()); - if (env->HasEnv(env_vars::kHeadless)) { + if (env->HasVar(env_vars::kHeadless)) { // If running the distributed tests, give the renderer a little time // to figure out that the channel is shutdown and unwind. if (WaitForSingleObject(process_, kWaitInterval) == WAIT_OBJECT_0) { diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.cc b/chrome/test/automated_ui_tests/automated_ui_tests.cc index 77726e0..1aad575 100644 --- a/chrome/test/automated_ui_tests/automated_ui_tests.cc +++ b/chrome/test/automated_ui_tests/automated_ui_tests.cc @@ -132,7 +132,7 @@ AutomatedUITest::AutomatedUITest() } } scoped_ptr<base::Environment> env(base::Environment::Create()); - if (env->HasEnv(env_vars::kHeadless)) + if (env->HasVar(env_vars::kHeadless)) logging::SetLogReportHandler(SilentRuntimeReportHandler); } diff --git a/chrome/test/ui/ui_test_suite.cc b/chrome/test/ui/ui_test_suite.cc index 5ba7f1f..934a8e9 100644 --- a/chrome/test/ui/ui_test_suite.cc +++ b/chrome/test/ui/ui_test_suite.cc @@ -115,7 +115,7 @@ void UITestSuite::SuppressErrorDialogs() { #if defined(OS_WIN) void UITestSuite::LoadCrashService() { scoped_ptr<base::Environment> env(base::Environment::Create()); - if (env->HasEnv(env_vars::kHeadless)) + if (env->HasVar(env_vars::kHeadless)) return; if (base::GetProcessCount(L"crash_service.exe", NULL)) diff --git a/media/audio/audio_output_controller_unittest.cc b/media/audio/audio_output_controller_unittest.cc index e64a00f..a68571a 100644 --- a/media/audio/audio_output_controller_unittest.cc +++ b/media/audio/audio_output_controller_unittest.cc @@ -63,7 +63,7 @@ static bool HasAudioOutputDevices() { static bool IsRunningHeadless() { scoped_ptr<base::Environment> env(base::Environment::Create()); - if (env->HasEnv("CHROME_HEADLESS")) + if (env->HasVar("CHROME_HEADLESS")) return true; return false; } diff --git a/webkit/tools/test_shell/test_shell_main.cc b/webkit/tools/test_shell/test_shell_main.cc index bbc55f3..a4c715d 100644 --- a/webkit/tools/test_shell/test_shell_main.cc +++ b/webkit/tools/test_shell/test_shell_main.cc @@ -94,7 +94,7 @@ int main(int argc, char* argv[]) { scoped_ptr<base::Environment> env(base::Environment::Create()); bool suppress_error_dialogs = ( - env->HasEnv("CHROME_HEADLESS") || + env->HasVar("CHROME_HEADLESS") || parsed_command_line.HasSwitch(test_shell::kNoErrorDialogs) || parsed_command_line.HasSwitch(test_shell::kLayoutTests)); bool layout_test_mode = |