Index: chromeos/dbus/ibus/ibus_engine_factory_service_unittest.cc |
diff --git a/chromeos/dbus/ibus/ibus_engine_factory_service_unittest.cc b/chromeos/dbus/ibus/ibus_engine_factory_service_unittest.cc |
index 205422d8bd7d9887f0108185d140659fe764a142..c3c2aa6f5b387a9ab19659584303af6924b4b96e 100644 |
--- a/chromeos/dbus/ibus/ibus_engine_factory_service_unittest.cc |
+++ b/chromeos/dbus/ibus/ibus_engine_factory_service_unittest.cc |
@@ -58,16 +58,22 @@ class MockCreateEngineResponseSender { |
public: |
explicit MockCreateEngineResponseSender(const dbus::ObjectPath& expected_path) |
: expected_path_(expected_path) {} |
- MOCK_METHOD1(Run, void(dbus::Response*)); |
+ // GMock doesn't support mocking methods which take scoped_ptr<>. |
+ MOCK_METHOD1(MockRun, void(dbus::Response*)); |
+ void Run(scoped_ptr<dbus::Response> response) { |
+ MockRun(response.get()); |
+ } |
// Checks the given |response| meets expectation for the CreateEngine method. |
- void CheckCreateEngineResponse(dbus::Response* response) { |
- scoped_ptr<dbus::Response> response_deleter(response); |
+ void CheckCreateEngineResponsePtr(dbus::Response* response) { |
dbus::MessageReader reader(response); |
dbus::ObjectPath actual_path; |
ASSERT_TRUE(reader.PopObjectPath(&actual_path)); |
EXPECT_EQ(expected_path_, actual_path); |
} |
+ void CheckCreateEngineResponse(scoped_ptr<dbus::Response> response) { |
+ CheckCreateEngineResponsePtr(response.get()); |
+ } |
private: |
dbus::ObjectPath expected_path_; |
@@ -143,10 +149,11 @@ TEST_F(IBusEngineFactoryServiceTest, SyncCreateEngineTest) { |
const char kSampleEngine[] = "Sample Engine"; |
const dbus::ObjectPath kObjectPath("/org/freedesktop/IBus/Engine/10"); |
MockCreateEngineResponseSender response_sender(kObjectPath); |
- EXPECT_CALL(response_sender, Run(_)) |
+ EXPECT_CALL(response_sender, MockRun(_)) |
.WillOnce( |
Invoke(&response_sender, |
- &MockCreateEngineResponseSender::CheckCreateEngineResponse)); |
+ &MockCreateEngineResponseSender:: |
+ CheckCreateEngineResponsePtr)); |
SynchronousCreateEngineHandler handler(kObjectPath); |
// Set handler expectations. |
@@ -185,10 +192,11 @@ TEST_F(IBusEngineFactoryServiceTest, AsyncCreateEngineTest) { |
const char kSampleEngine[] = "Sample Engine"; |
const dbus::ObjectPath kObjectPath("/org/freedesktop/IBus/Engine/10"); |
MockCreateEngineResponseSender response_sender(kObjectPath); |
- EXPECT_CALL(response_sender, Run(_)) |
+ EXPECT_CALL(response_sender, MockRun(_)) |
.WillOnce( |
Invoke(&response_sender, |
- &MockCreateEngineResponseSender::CheckCreateEngineResponse)); |
+ &MockCreateEngineResponseSender:: |
+ CheckCreateEngineResponsePtr)); |
AsynchronousCreateEngineHandler handler(kObjectPath, &message_loop_); |
// Set handler expectations. |