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

Side by Side Diff: base/xdg_util_unittest.cc

Issue 2843048: base: Add SetEnv() to EnvVarGetter class and get rid of the some ifdefs. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: filename 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 unified diff | Download patch
« no previous file with comments | « base/env_var.cc ('k') | chrome/browser/shell_integration_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/xdg_util.h" 5 #include "base/xdg_util.h"
6 6
7 #include "testing/gmock/include/gmock/gmock.h" 7 #include "testing/gmock/include/gmock/gmock.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 #include "base/env_var.h" 10 #include "base/env_var.h"
11 11
12 using ::testing::_; 12 using ::testing::_;
13 using ::testing::Return; 13 using ::testing::Return;
14 using ::testing::SetArgumentPointee; 14 using ::testing::SetArgumentPointee;
15 using ::testing::StrEq; 15 using ::testing::StrEq;
16 16
17 namespace { 17 namespace {
18 18
19 class MockEnvVarGetter : public base::EnvVarGetter { 19 class MockEnvVarGetter : public base::EnvVarGetter {
20 public: 20 public:
21 MOCK_METHOD2(GetEnv, bool(const char*, std::string* result)); 21 MOCK_METHOD2(GetEnv, bool(const char*, std::string* result));
22 MOCK_METHOD2(SetEnv, void(const char*, const std::string& new_value));
22 }; 23 };
23 24
24 const char* kGnome = "gnome"; 25 const char* kGnome = "gnome";
25 const char* kKDE4 = "kde4"; 26 const char* kKDE4 = "kde4";
26 const char* kKDE = "kde"; 27 const char* kKDE = "kde";
27 const char* kXFCE = "xfce"; 28 const char* kXFCE = "xfce";
28 29
29 } // namespace 30 } // namespace
30 31
31 TEST(XDGUtilTest, GetDesktopEnvironmentGnome) { 32 TEST(XDGUtilTest, GetDesktopEnvironmentGnome) {
(...skipping 28 matching lines...) Expand all
60 61
61 TEST(XDGUtilTest, GetDesktopEnvironmentXFCE) { 62 TEST(XDGUtilTest, GetDesktopEnvironmentXFCE) {
62 MockEnvVarGetter getter; 63 MockEnvVarGetter getter;
63 EXPECT_CALL(getter, GetEnv(_, _)).WillRepeatedly(Return(false)); 64 EXPECT_CALL(getter, GetEnv(_, _)).WillRepeatedly(Return(false));
64 EXPECT_CALL(getter, GetEnv(StrEq("DESKTOP_SESSION"), _)) 65 EXPECT_CALL(getter, GetEnv(StrEq("DESKTOP_SESSION"), _))
65 .WillOnce(DoAll(SetArgumentPointee<1>(kXFCE), Return(true))); 66 .WillOnce(DoAll(SetArgumentPointee<1>(kXFCE), Return(true)));
66 67
67 EXPECT_EQ(base::DESKTOP_ENVIRONMENT_XFCE, 68 EXPECT_EQ(base::DESKTOP_ENVIRONMENT_XFCE,
68 base::GetDesktopEnvironment(&getter)); 69 base::GetDesktopEnvironment(&getter));
69 } 70 }
OLDNEW
« no previous file with comments | « base/env_var.cc ('k') | chrome/browser/shell_integration_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698