diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-07 02:57:59 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-07 02:57:59 +0000 |
commit | 3ba7e0887015ba6a59579c4de08a6d609f851c23 (patch) | |
tree | d4b3ab95c9fa344346e2a1d3357916771587dcd1 /base | |
parent | 3eac24a2b4c9438196899e62ac2f3ae5f03ba039 (diff) | |
download | chromium_src-3ba7e0887015ba6a59579c4de08a6d609f851c23.zip chromium_src-3ba7e0887015ba6a59579c4de08a6d609f851c23.tar.gz chromium_src-3ba7e0887015ba6a59579c4de08a6d609f851c23.tar.bz2 |
base: rename Environment::GetEnv to Environment::GetVar.
This is the part 4 and the latest of this series.
BUG=None
TEST=trybots
Review URL: http://codereview.chromium.org/3029062
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55326 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/base_paths_posix.cc | 2 | ||||
-rw-r--r-- | base/environment.cc | 10 | ||||
-rw-r--r-- | base/environment.h | 4 | ||||
-rw-r--r-- | base/environment_unittest.cc | 6 | ||||
-rw-r--r-- | base/xdg_util.cc | 4 | ||||
-rw-r--r-- | base/xdg_util_unittest.cc | 18 |
6 files changed, 22 insertions, 22 deletions
diff --git a/base/base_paths_posix.cc b/base/base_paths_posix.cc index 8412009..45b397e 100644 --- a/base/base_paths_posix.cc +++ b/base/base_paths_posix.cc @@ -63,7 +63,7 @@ bool PathProviderPosix(int key, FilePath* result) { // tree configurations (sub-project builds, gyp --output_dir, etc.) scoped_ptr<base::Environment> env(base::Environment::Create()); std::string cr_source_root; - if (env->GetEnv("CR_SOURCE_ROOT", &cr_source_root)) { + if (env->GetVar("CR_SOURCE_ROOT", &cr_source_root)) { path = FilePath(cr_source_root); if (file_util::PathExists(path.Append("base/base_paths_posix.cc"))) { *result = path; diff --git a/base/environment.cc b/base/environment.cc index 6a6b556..2f2431e 100644 --- a/base/environment.cc +++ b/base/environment.cc @@ -21,8 +21,8 @@ namespace { class EnvironmentImpl : public base::Environment { public: - virtual bool GetEnv(const char* variable_name, std::string* result) { - if (GetEnvImpl(variable_name, result)) + virtual bool GetVar(const char* variable_name, std::string* result) { + if (GetVarImpl(variable_name, result)) return true; // Some commonly used variable names are uppercase while others @@ -37,7 +37,7 @@ class EnvironmentImpl : public base::Environment { alternate_case_var = StringToLowerASCII(std::string(variable_name)); else return false; - return GetEnvImpl(alternate_case_var.c_str(), result); + return GetVarImpl(alternate_case_var.c_str(), result); } virtual bool SetVar(const char* variable_name, const std::string& new_value) { @@ -49,7 +49,7 @@ class EnvironmentImpl : public base::Environment { } private: - bool GetEnvImpl(const char* variable_name, std::string* result) { + bool GetVarImpl(const char* variable_name, std::string* result) { #if defined(OS_POSIX) const char* env_value = getenv(variable_name); if (!env_value) @@ -120,7 +120,7 @@ Environment* Environment::Create() { } bool Environment::HasVar(const char* variable_name) { - return GetEnv(variable_name, NULL); + return GetVar(variable_name, NULL); } } // namespace base diff --git a/base/environment.h b/base/environment.h index ac83de3..4c0691b 100644 --- a/base/environment.h +++ b/base/environment.h @@ -30,9 +30,9 @@ class Environment { // Gets an environment variable's value and stores it in |result|. // Returns false if the key is unset. - virtual bool GetEnv(const char* variable_name, std::string* result) = 0; + virtual bool GetVar(const char* variable_name, std::string* result) = 0; - // Syntactic sugar for GetEnv(variable_name, NULL); + // Syntactic sugar for GetVar(variable_name, NULL); virtual bool HasVar(const char* variable_name); // Returns true on success, otherwise returns false. diff --git a/base/environment_unittest.cc b/base/environment_unittest.cc index ba48123..3d7ab3c 100644 --- a/base/environment_unittest.cc +++ b/base/environment_unittest.cc @@ -9,11 +9,11 @@ typedef PlatformTest EnvironmentTest; -TEST_F(EnvironmentTest, GetEnvVar) { +TEST_F(EnvironmentTest, GetVar) { // Every setup should have non-empty PATH... scoped_ptr<base::Environment> env(base::Environment::Create()); std::string env_value; - EXPECT_TRUE(env->GetEnv("PATH", &env_value)); + EXPECT_TRUE(env->GetVar("PATH", &env_value)); EXPECT_NE(env_value, ""); } @@ -34,7 +34,7 @@ TEST_F(EnvironmentTest, SetVar) { EXPECT_TRUE(env->HasVar(kFooUpper)); std::string var_value; - EXPECT_TRUE(env->GetEnv(kFooUpper, &var_value)); + EXPECT_TRUE(env->GetVar(kFooUpper, &var_value)); EXPECT_EQ(var_value, kFooLower); } diff --git a/base/xdg_util.cc b/base/xdg_util.cc index 6978986..017ae7a 100644 --- a/base/xdg_util.cc +++ b/base/xdg_util.cc @@ -14,7 +14,7 @@ namespace base { FilePath GetXDGDirectory(Environment* env, const char* env_name, const char* fallback_dir) { std::string env_value; - if (env->GetEnv(env_name, &env_value) && !env_value.empty()) + if (env->GetVar(env_name, &env_value) && !env_value.empty()) return FilePath(env_value); return file_util::GetHomeDir().Append(fallback_dir); } @@ -32,7 +32,7 @@ FilePath GetXDGUserDirectory(Environment* env, const char* dir_name, DesktopEnvironment GetDesktopEnvironment(Environment* env) { std::string desktop_session; - if (env->GetEnv("DESKTOP_SESSION", &desktop_session)) { + if (env->GetVar("DESKTOP_SESSION", &desktop_session)) { if (desktop_session == "gnome") { return DESKTOP_ENVIRONMENT_GNOME; } else if (desktop_session == "kde4") { diff --git a/base/xdg_util_unittest.cc b/base/xdg_util_unittest.cc index 09f65c4..c33fca5 100644 --- a/base/xdg_util_unittest.cc +++ b/base/xdg_util_unittest.cc @@ -17,7 +17,7 @@ namespace { class MockEnvironment : public base::Environment { public: - MOCK_METHOD2(GetEnv, bool(const char*, std::string* result)); + MOCK_METHOD2(GetVar, bool(const char*, std::string* result)); MOCK_METHOD2(SetVar, bool(const char*, const std::string& new_value)); MOCK_METHOD1(UnSetVar, bool(const char*)); }; @@ -31,8 +31,8 @@ const char* kXFCE = "xfce"; TEST(XDGUtilTest, GetDesktopEnvironmentGnome) { MockEnvironment getter; - EXPECT_CALL(getter, GetEnv(_, _)).WillRepeatedly(Return(false)); - EXPECT_CALL(getter, GetEnv(StrEq("DESKTOP_SESSION"), _)) + EXPECT_CALL(getter, GetVar(_, _)).WillRepeatedly(Return(false)); + EXPECT_CALL(getter, GetVar(StrEq("DESKTOP_SESSION"), _)) .WillOnce(DoAll(SetArgumentPointee<1>(kGnome), Return(true))); EXPECT_EQ(base::DESKTOP_ENVIRONMENT_GNOME, @@ -41,8 +41,8 @@ TEST(XDGUtilTest, GetDesktopEnvironmentGnome) { TEST(XDGUtilTest, GetDesktopEnvironmentKDE4) { MockEnvironment getter; - EXPECT_CALL(getter, GetEnv(_, _)).WillRepeatedly(Return(false)); - EXPECT_CALL(getter, GetEnv(StrEq("DESKTOP_SESSION"), _)) + EXPECT_CALL(getter, GetVar(_, _)).WillRepeatedly(Return(false)); + EXPECT_CALL(getter, GetVar(StrEq("DESKTOP_SESSION"), _)) .WillOnce(DoAll(SetArgumentPointee<1>(kKDE4), Return(true))); EXPECT_EQ(base::DESKTOP_ENVIRONMENT_KDE4, @@ -51,8 +51,8 @@ TEST(XDGUtilTest, GetDesktopEnvironmentKDE4) { TEST(XDGUtilTest, GetDesktopEnvironmentKDE3) { MockEnvironment getter; - EXPECT_CALL(getter, GetEnv(_, _)).WillRepeatedly(Return(false)); - EXPECT_CALL(getter, GetEnv(StrEq("DESKTOP_SESSION"), _)) + EXPECT_CALL(getter, GetVar(_, _)).WillRepeatedly(Return(false)); + EXPECT_CALL(getter, GetVar(StrEq("DESKTOP_SESSION"), _)) .WillOnce(DoAll(SetArgumentPointee<1>(kKDE), Return(true))); EXPECT_EQ(base::DESKTOP_ENVIRONMENT_KDE3, @@ -61,8 +61,8 @@ TEST(XDGUtilTest, GetDesktopEnvironmentKDE3) { TEST(XDGUtilTest, GetDesktopEnvironmentXFCE) { MockEnvironment getter; - EXPECT_CALL(getter, GetEnv(_, _)).WillRepeatedly(Return(false)); - EXPECT_CALL(getter, GetEnv(StrEq("DESKTOP_SESSION"), _)) + EXPECT_CALL(getter, GetVar(_, _)).WillRepeatedly(Return(false)); + EXPECT_CALL(getter, GetVar(StrEq("DESKTOP_SESSION"), _)) .WillOnce(DoAll(SetArgumentPointee<1>(kXFCE), Return(true))); EXPECT_EQ(base::DESKTOP_ENVIRONMENT_XFCE, |