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

Unified Diff: dbus/mock_object_proxy.h

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 | « dbus/message.cc ('k') | dbus/mock_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dbus/mock_object_proxy.h
diff --git a/dbus/mock_object_proxy.h b/dbus/mock_object_proxy.h
index e820f45a08b97517233b75f5b26a63622f0d914f..fcad8607248607a7dba61ad838bb2b019cc52224 100644
--- a/dbus/mock_object_proxy.h
+++ b/dbus/mock_object_proxy.h
@@ -7,6 +7,7 @@
#include <string>
+#include "dbus/message.h"
#include "dbus/object_path.h"
#include "dbus/object_proxy.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -20,8 +21,17 @@ class MockObjectProxy : public ObjectProxy {
const std::string& service_name,
const ObjectPath& object_path);
- MOCK_METHOD2(CallMethodAndBlock, Response*(MethodCall* method_call,
- int timeout_ms));
+ // GMock doesn't support the return type of scoped_ptr<> because scoped_ptr is
+ // uncopyable. This is a workaround which defines |MockCallMethodAndBlock| as
+ // a mock method and makes |CallMethodAndBlock| call the mocked method.
+ // Use |MockCallMethodAndBlock| for setting/testing expectations.
+ MOCK_METHOD2(MockCallMethodAndBlock, Response*(MethodCall* method_call,
+ int timeout_ms));
+ virtual scoped_ptr<Response> CallMethodAndBlock(MethodCall* method_call,
+ int timeout_ms) OVERRIDE {
+ return scoped_ptr<Response>(MockCallMethodAndBlock(method_call,
+ timeout_ms));
+ }
MOCK_METHOD3(CallMethod, void(MethodCall* method_call,
int timeout_ms,
ResponseCallback callback));
« no previous file with comments | « dbus/message.cc ('k') | dbus/mock_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698