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

Unified Diff: chromeos/dbus/ibus/ibus_engine_factory_service_unittest.cc

Issue 12092061: Code cleaning: Uses scoped_ptr<> to express ownership rather than writing ownership in comments. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added chrome/browser/password_manager/native_backend_kwallet_x_unitte\ Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/dbus/ibus/ibus_engine_factory_service.cc ('k') | chromeos/dbus/ibus/ibus_engine_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « chromeos/dbus/ibus/ibus_engine_factory_service.cc ('k') | chromeos/dbus/ibus/ibus_engine_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698