[M120 Migration][VD] Fix url crash in RequestCertificateConfirm
[platform/framework/web/chromium-efl.git] / dbus / mock_object_proxy.h
1 // Copyright 2012 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef DBUS_MOCK_OBJECT_PROXY_H_
6 #define DBUS_MOCK_OBJECT_PROXY_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "base/types/expected.h"
12 #include "dbus/error.h"
13 #include "dbus/message.h"
14 #include "dbus/object_path.h"
15 #include "dbus/object_proxy.h"
16 #include "testing/gmock/include/gmock/gmock.h"
17
18 namespace dbus {
19
20 // Mock for ObjectProxy.
21 class MockObjectProxy : public ObjectProxy {
22  public:
23   MockObjectProxy(Bus* bus,
24                   const std::string& service_name,
25                   const ObjectPath& object_path);
26
27   MOCK_METHOD2(
28       CallMethodAndBlock,
29       base::expected<std::unique_ptr<Response>, Error>(MethodCall* method_call,
30                                                        int timeout_ms));
31
32   // This method is not mockable because it takes a move-only argument. To work
33   // around this, CallMethod() implementation here calls DoCallMethod() which is
34   // mockable.
35   void CallMethod(MethodCall* method_call,
36                   int timeout_ms,
37                   ResponseCallback callback) override;
38   MOCK_METHOD3(DoCallMethod,
39                void(MethodCall* method_call,
40                     int timeout_ms,
41                     ResponseCallback* callback));
42
43   // This method is not mockable because it takes a move-only argument. To work
44   // around this, CallMethodWithErrorResponse() implementation here calls
45   // DoCallMethodWithErrorResponse() which is mockable.
46   void CallMethodWithErrorResponse(MethodCall* method_call,
47                                    int timeout_ms,
48                                    ResponseOrErrorCallback callback) override;
49   MOCK_METHOD3(DoCallMethodWithErrorResponse,
50                void(MethodCall* method_call,
51                     int timeout_ms,
52                     ResponseOrErrorCallback* callback));
53
54   // This method is not mockable because it takes a move-only argument. To work
55   // around this, CallMethodWithErrorCallback() implementation here calls
56   // DoCallMethodWithErrorCallback() which is mockable.
57   void CallMethodWithErrorCallback(MethodCall* method_call,
58                                    int timeout_ms,
59                                    ResponseCallback callback,
60                                    ErrorCallback error_callback) override;
61   MOCK_METHOD4(DoCallMethodWithErrorCallback,
62                void(MethodCall* method_call,
63                     int timeout_ms,
64                     ResponseCallback* callback,
65                     ErrorCallback* error_callback));
66
67   // This method is not mockable because it takes a move-only argument. To work
68   // around this, WaitForServiceToBeAvailable() implementation here calls
69   // DoWaitForServiceToBeAvailable() which is mockable.
70   void WaitForServiceToBeAvailable(
71       WaitForServiceToBeAvailableCallback callback) override;
72   MOCK_METHOD1(DoWaitForServiceToBeAvailable,
73                void(WaitForServiceToBeAvailableCallback* callback));
74
75   // This method is not mockable because it takes a move-only argument. To work
76   // around this, ConnectToSignal() implementation here calls
77   // DoConnectToSignal() which is mockable.
78   void ConnectToSignal(const std::string& interface_name,
79                        const std::string& signal_name,
80                        SignalCallback signal_callback,
81                        OnConnectedCallback on_connected_callback) override;
82   MOCK_METHOD4(DoConnectToSignal,
83                void(const std::string& interface_name,
84                     const std::string& signal_name,
85                     SignalCallback signal_callback,
86                     OnConnectedCallback* on_connected_callback));
87   MOCK_METHOD1(SetNameOwnerChangedCallback,
88                void(NameOwnerChangedCallback callback));
89   MOCK_METHOD0(Detach, void());
90
91  protected:
92   ~MockObjectProxy() override;
93 };
94
95 }  // namespace dbus
96
97 #endif  // DBUS_MOCK_OBJECT_PROXY_H_