From eadafb5815145a401cbfa6da559de01cb35d3a2b Mon Sep 17 00:00:00 2001 From: Qijiang Fan Date: Tue, 17 Dec 2019 17:21:54 +0900 Subject: [PATCH 3/5] mock object proxy WaitForServiceToBeAvailable Change-Id: I01d2e49547f0e9083df60de69ef254761de2c00e --- dbus/mock_object_proxy.cc | 5 +++++ dbus/mock_object_proxy.h | 6 +++++++ 2 files changed, 11 insertions(+) diff --git a/dbus/mock_object_proxy.cc b/dbus/mock_object_proxy.cc index 4929486..a1f2edd 100644 --- a/dbus/mock_object_proxy.cc +++ b/dbus/mock_object_proxy.cc @@ -45,4 +45,9 @@ void MockObjectProxy::ConnectToSignal( &on_connected_callback); } +void MockObjectProxy::WaitForServiceToBeAvailable( + WaitForServiceToBeAvailableCallback callback) { + DoWaitForServiceToBeAvailable(&callback); +} + } // namespace dbus diff --git a/dbus/mock_object_proxy.h b/dbus/mock_object_proxy.h index 7bc2376..abc793a 100644 --- a/dbus/mock_object_proxy.h +++ b/dbus/mock_object_proxy.h @@ -89,6 +90,12 @@ class MockObjectProxy : public ObjectProxy { OnConnectedCallback* on_connected_callback)); MOCK_METHOD1(SetNameOwnerChangedCallback, void(NameOwnerChangedCallback callback)); + // This method is not mockable because it takes a move-only argument. To work + // around this. WaitForServiceToBeAvailable implements here calls + // DoWaitForServiceToBeAvailable which is mockable. + void WaitForServiceToBeAvailable(WaitForServiceToBeAvailableCallback callback) override; + MOCK_METHOD1(DoWaitForServiceToBeAvailable, + void(WaitForServiceToBeAvailableCallback* callback)); MOCK_METHOD0(Detach, void()); protected: -- 2.24.1.735.g03f4e72817-goog