[M120 Migration][VD] Fix url crash in RequestCertificateConfirm
[platform/framework/web/chromium-efl.git] / dbus / mock_bus.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_BUS_H_
6 #define DBUS_MOCK_BUS_H_
7
8 #include <stdint.h>
9
10 #include "base/task/sequenced_task_runner.h"
11 #include "dbus/bus.h"
12 #include "dbus/message.h"
13 #include "dbus/object_path.h"
14 #include "testing/gmock/include/gmock/gmock.h"
15
16 namespace dbus {
17
18 // Mock for Bus class. Along with MockObjectProxy and MockExportedObject,
19 // the mock classes can be used to write unit tests without issuing real
20 // D-Bus calls.
21 class MockBus : public Bus {
22  public:
23   MockBus(const Bus::Options& options);
24
25   MOCK_METHOD2(GetObjectProxy, ObjectProxy*(const std::string& service_name,
26                                             const ObjectPath& object_path));
27   MOCK_METHOD3(GetObjectProxyWithOptions,
28                ObjectProxy*(const std::string& service_name,
29                             const ObjectPath& object_path,
30                             int options));
31   MOCK_METHOD1(GetExportedObject, ExportedObject*(
32       const ObjectPath& object_path));
33   MOCK_METHOD2(GetObjectManager, ObjectManager*(const std::string&,
34                                                 const ObjectPath&));
35   MOCK_METHOD0(ShutdownAndBlock, void());
36   MOCK_METHOD0(ShutdownOnDBusThreadAndBlock, void());
37   MOCK_METHOD0(Connect, bool());
38   MOCK_METHOD3(RequestOwnership, void(
39       const std::string& service_name,
40       ServiceOwnershipOptions options,
41       OnOwnershipCallback on_ownership_callback));
42   MOCK_METHOD2(RequestOwnershipAndBlock, bool(const std::string& service_name,
43                                               ServiceOwnershipOptions options));
44   MOCK_METHOD1(ReleaseOwnership, bool(const std::string& service_name));
45   MOCK_METHOD0(SetUpAsyncOperations, bool());
46   MOCK_METHOD2(
47       SendWithReplyAndBlock,
48       base::expected<std::unique_ptr<Response>, Error>(DBusMessage* request,
49                                                        int timeout_ms));
50   MOCK_METHOD3(SendWithReply, void(DBusMessage* request,
51                                    DBusPendingCall** pending_call,
52                                    int timeout_ms));
53   MOCK_METHOD2(Send, void(DBusMessage* request, uint32_t* serial));
54   MOCK_METHOD2(AddFilterFunction,
55                void(DBusHandleMessageFunction filter_function,
56                     void* user_data));
57   MOCK_METHOD2(RemoveFilterFunction,
58                void(DBusHandleMessageFunction filter_function,
59                     void* user_data));
60   MOCK_METHOD2(AddMatch, void(const std::string& match_rule, Error* error));
61   MOCK_METHOD2(RemoveMatch, bool(const std::string& match_rule, Error* error));
62   MOCK_METHOD4(TryRegisterObjectPath,
63                bool(const ObjectPath& object_path,
64                     const DBusObjectPathVTable* vtable,
65                     void* user_data,
66                     Error* error));
67   MOCK_METHOD4(TryRegisterFallback,
68                bool(const ObjectPath& object_path,
69                     const DBusObjectPathVTable* vtable,
70                     void* user_data,
71                     Error* error));
72   MOCK_METHOD1(UnregisterObjectPath, void(const ObjectPath& object_path));
73   MOCK_METHOD0(GetDBusTaskRunner, base::SequencedTaskRunner*());
74   MOCK_METHOD0(GetOriginTaskRunner, base::SequencedTaskRunner*());
75   MOCK_METHOD0(HasDBusThread, bool());
76   MOCK_METHOD0(AssertOnOriginThread, void());
77   MOCK_METHOD0(AssertOnDBusThread, void());
78   MOCK_METHOD0(IsConnected, bool());
79
80  protected:
81   ~MockBus() override;
82 };
83
84 }  // namespace dbus
85
86 #endif  // DBUS_MOCK_BUS_H_