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

Unified Diff: chromeos/dbus/flimflam_client_unittest_base.cc

Issue 10170020: Rework chromeos::FlimflamDevice/ServiceClient with CallMethodWithErrorCallback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 8 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/flimflam_client_unittest_base.h ('k') | chromeos/dbus/flimflam_device_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/flimflam_client_unittest_base.cc
diff --git a/chromeos/dbus/flimflam_client_unittest_base.cc b/chromeos/dbus/flimflam_client_unittest_base.cc
index dc4473ba147a916adcac139fa53cf3c440289414..67046f9841ea6a181a270f8259f8bf12c7e23c43 100644
--- a/chromeos/dbus/flimflam_client_unittest_base.cc
+++ b/chromeos/dbus/flimflam_client_unittest_base.cc
@@ -30,11 +30,31 @@ void RunTask(const tracked_objects::Location& from_here,
} // namespace
+FlimflamClientUnittestBase::MockClosure::MockClosure() {}
+
+FlimflamClientUnittestBase::MockClosure::~MockClosure() {}
+
+base::Closure FlimflamClientUnittestBase::MockClosure::GetCallback() {
+ return base::Bind(&MockClosure::Run, base::Unretained(this));
+}
+
+
+FlimflamClientUnittestBase::MockErrorCallback::MockErrorCallback() {}
+
+FlimflamClientUnittestBase::MockErrorCallback::~MockErrorCallback() {}
+
+FlimflamClientHelper::ErrorCallback
+FlimflamClientUnittestBase::MockErrorCallback::GetCallback() {
+ return base::Bind(&MockErrorCallback::Run, base::Unretained(this));
+}
+
+
FlimflamClientUnittestBase::FlimflamClientUnittestBase(
const std::string& interface_name,
const dbus::ObjectPath& object_path)
: interface_name_(interface_name),
- object_path_(object_path) {
+ object_path_(object_path),
+ response_(NULL) {
}
FlimflamClientUnittestBase::~FlimflamClientUnittestBase() {
@@ -63,6 +83,12 @@ void FlimflamClientUnittestBase::SetUp() {
EXPECT_CALL(*mock_proxy_, CallMethod(_, _, _))
.WillRepeatedly(Invoke(this, &FlimflamClientUnittestBase::OnCallMethod));
+ // Set an expectation so mock_proxy's CallMethodWithErrorCallback() will use
+ // OnCallMethodWithErrorCallback() to return responses.
+ EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _))
+ .WillRepeatedly(Invoke(
+ this, &FlimflamClientUnittestBase::OnCallMethodWithErrorCallback));
+
// Set an expectation so mock_proxy's ConnectToSignal() will use
// OnConnectToSignal() to run the callback.
EXPECT_CALL(*mock_proxy_, ConnectToSignal(
@@ -208,6 +234,14 @@ void FlimflamClientUnittestBase::OnCallMethod(
base::Bind(response_callback, response_));
}
+void FlimflamClientUnittestBase::OnCallMethodWithErrorCallback(
+ dbus::MethodCall* method_call,
+ int timeout_ms,
+ const dbus::ObjectProxy::ResponseCallback& response_callback,
+ const dbus::ObjectProxy::ErrorCallback& error_callback) {
+ OnCallMethod(method_call, timeout_ms, response_callback);
+}
+
dbus::Response* FlimflamClientUnittestBase::OnCallMethodAndBlock(
dbus::MethodCall* method_call,
int timeout_ms) {
« no previous file with comments | « chromeos/dbus/flimflam_client_unittest_base.h ('k') | chromeos/dbus/flimflam_device_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698