Index: base/nix/xdg_util_unittest.cc |
diff --git a/base/nix/xdg_util_unittest.cc b/base/nix/xdg_util_unittest.cc |
index a05435545abc8097bbe2af7f5f3a06ec10de0819..c8e53616ccdcfac88fb5960aacdc7c2cc212fff9 100644 |
--- a/base/nix/xdg_util_unittest.cc |
+++ b/base/nix/xdg_util_unittest.cc |
@@ -9,9 +9,9 @@ |
#include "testing/gtest/include/gtest/gtest.h" |
using ::testing::_; |
+using ::testing::Eq; |
using ::testing::Return; |
using ::testing::SetArgumentPointee; |
-using ::testing::StrEq; |
namespace base { |
namespace nix { |
@@ -20,9 +20,9 @@ namespace { |
class MockEnvironment : public Environment { |
public: |
- 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*)); |
+ MOCK_METHOD2(GetVar, bool(StringPiece, std::string* result)); |
+ MOCK_METHOD2(SetVar, bool(StringPiece, const std::string& new_value)); |
+ MOCK_METHOD1(UnSetVar, bool(StringPiece)); |
}; |
// Needs to be const char* to make gmock happy. |
@@ -46,7 +46,7 @@ const char kXdgDesktop[] = "XDG_CURRENT_DESKTOP"; |
TEST(XDGUtilTest, GetDesktopEnvironmentGnome) { |
MockEnvironment getter; |
EXPECT_CALL(getter, GetVar(_, _)).WillRepeatedly(Return(false)); |
- EXPECT_CALL(getter, GetVar(StrEq(kDesktopSession), _)) |
+ EXPECT_CALL(getter, GetVar(Eq(kDesktopSession), _)) |
.WillOnce(DoAll(SetArgumentPointee<1>(kDesktopGnome), Return(true))); |
EXPECT_EQ(DESKTOP_ENVIRONMENT_GNOME, GetDesktopEnvironment(&getter)); |
@@ -55,7 +55,7 @@ TEST(XDGUtilTest, GetDesktopEnvironmentGnome) { |
TEST(XDGUtilTest, GetDesktopEnvironmentMATE) { |
MockEnvironment getter; |
EXPECT_CALL(getter, GetVar(_, _)).WillRepeatedly(Return(false)); |
- EXPECT_CALL(getter, GetVar(StrEq(kDesktopSession), _)) |
+ EXPECT_CALL(getter, GetVar(Eq(kDesktopSession), _)) |
.WillOnce(DoAll(SetArgumentPointee<1>(kDesktopMATE), Return(true))); |
EXPECT_EQ(DESKTOP_ENVIRONMENT_GNOME, GetDesktopEnvironment(&getter)); |
@@ -64,7 +64,7 @@ TEST(XDGUtilTest, GetDesktopEnvironmentMATE) { |
TEST(XDGUtilTest, GetDesktopEnvironmentKDE4) { |
MockEnvironment getter; |
EXPECT_CALL(getter, GetVar(_, _)).WillRepeatedly(Return(false)); |
- EXPECT_CALL(getter, GetVar(StrEq(kDesktopSession), _)) |
+ EXPECT_CALL(getter, GetVar(Eq(kDesktopSession), _)) |
.WillOnce(DoAll(SetArgumentPointee<1>(kDesktopKDE4), Return(true))); |
EXPECT_EQ(DESKTOP_ENVIRONMENT_KDE4, GetDesktopEnvironment(&getter)); |
@@ -73,7 +73,7 @@ TEST(XDGUtilTest, GetDesktopEnvironmentKDE4) { |
TEST(XDGUtilTest, GetDesktopEnvironmentKDE3) { |
MockEnvironment getter; |
EXPECT_CALL(getter, GetVar(_, _)).WillRepeatedly(Return(false)); |
- EXPECT_CALL(getter, GetVar(StrEq(kDesktopSession), _)) |
+ EXPECT_CALL(getter, GetVar(Eq(kDesktopSession), _)) |
.WillOnce(DoAll(SetArgumentPointee<1>(kDesktopKDE), Return(true))); |
EXPECT_EQ(DESKTOP_ENVIRONMENT_KDE3, GetDesktopEnvironment(&getter)); |
@@ -82,7 +82,7 @@ TEST(XDGUtilTest, GetDesktopEnvironmentKDE3) { |
TEST(XDGUtilTest, GetDesktopEnvironmentXFCE) { |
MockEnvironment getter; |
EXPECT_CALL(getter, GetVar(_, _)).WillRepeatedly(Return(false)); |
- EXPECT_CALL(getter, GetVar(StrEq(kDesktopSession), _)) |
+ EXPECT_CALL(getter, GetVar(Eq(kDesktopSession), _)) |
.WillOnce(DoAll(SetArgumentPointee<1>(kDesktopXFCE), Return(true))); |
EXPECT_EQ(DESKTOP_ENVIRONMENT_XFCE, GetDesktopEnvironment(&getter)); |
@@ -91,7 +91,7 @@ TEST(XDGUtilTest, GetDesktopEnvironmentXFCE) { |
TEST(XDGUtilTest, GetXdgDesktopGnome) { |
MockEnvironment getter; |
EXPECT_CALL(getter, GetVar(_, _)).WillRepeatedly(Return(false)); |
- EXPECT_CALL(getter, GetVar(StrEq(kXdgDesktop), _)) |
+ EXPECT_CALL(getter, GetVar(Eq(kXdgDesktop), _)) |
.WillOnce(DoAll(SetArgumentPointee<1>(kXdgDesktopGNOME), Return(true))); |
EXPECT_EQ(DESKTOP_ENVIRONMENT_GNOME, GetDesktopEnvironment(&getter)); |
@@ -100,11 +100,11 @@ TEST(XDGUtilTest, GetXdgDesktopGnome) { |
TEST(XDGUtilTest, GetXdgDesktopGnomeFallback) { |
MockEnvironment getter; |
EXPECT_CALL(getter, GetVar(_, _)).WillRepeatedly(Return(false)); |
- EXPECT_CALL(getter, GetVar(StrEq(kXdgDesktop), _)) |
+ EXPECT_CALL(getter, GetVar(Eq(kXdgDesktop), _)) |
.WillOnce(DoAll(SetArgumentPointee<1>(kXdgDesktopUnity), Return(true))); |
- EXPECT_CALL(getter, GetVar(StrEq(kDesktopSession), _)) |
- .WillOnce(DoAll(SetArgumentPointee<1>(kDesktopGnomeFallback), |
- Return(true))); |
+ EXPECT_CALL(getter, GetVar(Eq(kDesktopSession), _)) |
+ .WillOnce( |
+ DoAll(SetArgumentPointee<1>(kDesktopGnomeFallback), Return(true))); |
EXPECT_EQ(DESKTOP_ENVIRONMENT_GNOME, GetDesktopEnvironment(&getter)); |
} |
@@ -112,10 +112,10 @@ TEST(XDGUtilTest, GetXdgDesktopGnomeFallback) { |
TEST(XDGUtilTest, GetXdgDesktopKDE5) { |
MockEnvironment getter; |
EXPECT_CALL(getter, GetVar(_, _)).WillRepeatedly(Return(false)); |
- EXPECT_CALL(getter, GetVar(StrEq(kXdgDesktop), _)) |
+ EXPECT_CALL(getter, GetVar(Eq(kXdgDesktop), _)) |
.WillOnce(DoAll(SetArgumentPointee<1>(kXdgDesktopKDE), Return(true))); |
- EXPECT_CALL(getter, GetVar(StrEq(kKDESession), _)) |
- .WillOnce(DoAll(SetArgumentPointee<1>(kKDESessionKDE5), Return(true))); |
+ EXPECT_CALL(getter, GetVar(Eq(kKDESession), _)) |
+ .WillOnce(DoAll(SetArgumentPointee<1>(kKDESessionKDE5), Return(true))); |
EXPECT_EQ(DESKTOP_ENVIRONMENT_KDE5, GetDesktopEnvironment(&getter)); |
} |
@@ -123,7 +123,7 @@ TEST(XDGUtilTest, GetXdgDesktopKDE5) { |
TEST(XDGUtilTest, GetXdgDesktopKDE4) { |
MockEnvironment getter; |
EXPECT_CALL(getter, GetVar(_, _)).WillRepeatedly(Return(false)); |
- EXPECT_CALL(getter, GetVar(StrEq(kXdgDesktop), _)) |
+ EXPECT_CALL(getter, GetVar(Eq(kXdgDesktop), _)) |
.WillOnce(DoAll(SetArgumentPointee<1>(kXdgDesktopKDE), Return(true))); |
EXPECT_EQ(DESKTOP_ENVIRONMENT_KDE4, GetDesktopEnvironment(&getter)); |
@@ -132,7 +132,7 @@ TEST(XDGUtilTest, GetXdgDesktopKDE4) { |
TEST(XDGUtilTest, GetXdgDesktopUnity) { |
MockEnvironment getter; |
EXPECT_CALL(getter, GetVar(_, _)).WillRepeatedly(Return(false)); |
- EXPECT_CALL(getter, GetVar(StrEq(kXdgDesktop), _)) |
+ EXPECT_CALL(getter, GetVar(Eq(kXdgDesktop), _)) |
.WillOnce(DoAll(SetArgumentPointee<1>(kXdgDesktopUnity), Return(true))); |
EXPECT_EQ(DESKTOP_ENVIRONMENT_UNITY, GetDesktopEnvironment(&getter)); |