OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef DBUS_MOCK_BUS_H_ | 5 #ifndef DBUS_MOCK_BUS_H_ |
6 #define DBUS_MOCK_BUS_H_ | 6 #define DBUS_MOCK_BUS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "dbus/bus.h" | 9 #include "dbus/bus.h" |
10 #include "dbus/object_path.h" | 10 #include "dbus/object_path.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
12 | 12 |
13 namespace dbus { | 13 namespace dbus { |
14 | 14 |
15 // Mock for Bus class. Along with MockObjectProxy and MockExportedObject, | 15 // Mock for Bus class. Along with MockObjectProxy and MockExportedObject, |
16 // the mock classes can be used to write unit tests without issuing real | 16 // the mock classes can be used to write unit tests without issuing real |
17 // D-Bus calls. | 17 // D-Bus calls. |
18 class MockBus : public Bus { | 18 class MockBus : public Bus { |
19 public: | 19 public: |
20 MockBus(Bus::Options& options); | 20 MockBus(Bus::Options& options); |
21 virtual ~MockBus(); | 21 virtual ~MockBus(); |
22 | 22 |
23 MOCK_METHOD2(GetObjectProxy, ObjectProxy*(const std::string& service_name, | 23 MOCK_METHOD2(GetObjectProxy, ObjectProxy*(const std::string& service_name, |
24 const ObjectPath& object_path)); | 24 const ObjectPath& object_path)); |
25 MOCK_METHOD3(GetObjectProxyWithOptions, | 25 MOCK_METHOD3(GetObjectProxyWithOptions, |
26 ObjectProxy*(const std::string& service_name, | 26 ObjectProxy*(const std::string& service_name, |
27 const ObjectPath& object_path, | 27 const ObjectPath& object_path, |
28 int options)); | 28 int options)); |
29 MOCK_METHOD2(GetExportedObject, ExportedObject*( | 29 MOCK_METHOD1(GetExportedObject, ExportedObject*( |
30 const std::string& service_name, | |
31 const ObjectPath& object_path)); | 30 const ObjectPath& object_path)); |
32 MOCK_METHOD0(ShutdownAndBlock, void()); | 31 MOCK_METHOD0(ShutdownAndBlock, void()); |
33 MOCK_METHOD0(ShutdownOnDBusThreadAndBlock, void()); | 32 MOCK_METHOD0(ShutdownOnDBusThreadAndBlock, void()); |
34 MOCK_METHOD0(Connect, bool()); | 33 MOCK_METHOD0(Connect, bool()); |
35 MOCK_METHOD1(RequestOwnership, bool(const std::string& service_name)); | 34 MOCK_METHOD2(RequestOwnership, void( |
| 35 const std::string& service_name, |
| 36 OnOwnershipCallback on_ownership_callback)); |
| 37 MOCK_METHOD1(RequestOwnershipAndBlock, bool(const std::string& service_name)); |
36 MOCK_METHOD1(ReleaseOwnership, bool(const std::string& service_name)); | 38 MOCK_METHOD1(ReleaseOwnership, bool(const std::string& service_name)); |
37 MOCK_METHOD0(SetUpAsyncOperations, bool()); | 39 MOCK_METHOD0(SetUpAsyncOperations, bool()); |
38 MOCK_METHOD3(SendWithReplyAndBlock, DBusMessage*(DBusMessage* request, | 40 MOCK_METHOD3(SendWithReplyAndBlock, DBusMessage*(DBusMessage* request, |
39 int timeout_ms, | 41 int timeout_ms, |
40 DBusError* error)); | 42 DBusError* error)); |
41 MOCK_METHOD3(SendWithReply, void(DBusMessage* request, | 43 MOCK_METHOD3(SendWithReply, void(DBusMessage* request, |
42 DBusPendingCall** pending_call, | 44 DBusPendingCall** pending_call, |
43 int timeout_ms)); | 45 int timeout_ms)); |
44 MOCK_METHOD2(Send, void(DBusMessage* request, | 46 MOCK_METHOD2(Send, void(DBusMessage* request, |
45 uint32* serial)); | 47 uint32* serial)); |
(...skipping 21 matching lines...) Expand all Loading... |
67 const base::Closure& task, | 69 const base::Closure& task, |
68 int delay_ms)); | 70 int delay_ms)); |
69 MOCK_METHOD0(HasDBusThread, bool()); | 71 MOCK_METHOD0(HasDBusThread, bool()); |
70 MOCK_METHOD0(AssertOnOriginThread, void()); | 72 MOCK_METHOD0(AssertOnOriginThread, void()); |
71 MOCK_METHOD0(AssertOnDBusThread, void()); | 73 MOCK_METHOD0(AssertOnDBusThread, void()); |
72 }; | 74 }; |
73 | 75 |
74 } // namespace dbus | 76 } // namespace dbus |
75 | 77 |
76 #endif // DBUS_MOCK_BUS_H_ | 78 #endif // DBUS_MOCK_BUS_H_ |
OLD | NEW |