| 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 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include "dbus/bus.h" | 10 #include "dbus/bus.h" |
| 9 #include "dbus/object_path.h" | 11 #include "dbus/object_path.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
| 11 | 13 |
| 12 namespace dbus { | 14 namespace dbus { |
| 13 | 15 |
| 14 // Mock for Bus class. Along with MockObjectProxy and MockExportedObject, | 16 // Mock for Bus class. Along with MockObjectProxy and MockExportedObject, |
| 15 // the mock classes can be used to write unit tests without issuing real | 17 // the mock classes can be used to write unit tests without issuing real |
| 16 // D-Bus calls. | 18 // D-Bus calls. |
| 17 class MockBus : public Bus { | 19 class MockBus : public Bus { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 38 MOCK_METHOD2(RequestOwnershipAndBlock, bool(const std::string& service_name, | 40 MOCK_METHOD2(RequestOwnershipAndBlock, bool(const std::string& service_name, |
| 39 ServiceOwnershipOptions options)); | 41 ServiceOwnershipOptions options)); |
| 40 MOCK_METHOD1(ReleaseOwnership, bool(const std::string& service_name)); | 42 MOCK_METHOD1(ReleaseOwnership, bool(const std::string& service_name)); |
| 41 MOCK_METHOD0(SetUpAsyncOperations, bool()); | 43 MOCK_METHOD0(SetUpAsyncOperations, bool()); |
| 42 MOCK_METHOD3(SendWithReplyAndBlock, DBusMessage*(DBusMessage* request, | 44 MOCK_METHOD3(SendWithReplyAndBlock, DBusMessage*(DBusMessage* request, |
| 43 int timeout_ms, | 45 int timeout_ms, |
| 44 DBusError* error)); | 46 DBusError* error)); |
| 45 MOCK_METHOD3(SendWithReply, void(DBusMessage* request, | 47 MOCK_METHOD3(SendWithReply, void(DBusMessage* request, |
| 46 DBusPendingCall** pending_call, | 48 DBusPendingCall** pending_call, |
| 47 int timeout_ms)); | 49 int timeout_ms)); |
| 48 MOCK_METHOD2(Send, void(DBusMessage* request, | 50 MOCK_METHOD2(Send, void(DBusMessage* request, uint32_t* serial)); |
| 49 uint32* serial)); | |
| 50 MOCK_METHOD2(AddFilter, void(DBusHandleMessageFunction handle_message, | 51 MOCK_METHOD2(AddFilter, void(DBusHandleMessageFunction handle_message, |
| 51 void* user_data)); | 52 void* user_data)); |
| 52 MOCK_METHOD2(RemoveFilter, void(DBusHandleMessageFunction handle_message, | 53 MOCK_METHOD2(RemoveFilter, void(DBusHandleMessageFunction handle_message, |
| 53 void* user_data)); | 54 void* user_data)); |
| 54 MOCK_METHOD2(AddMatch, void(const std::string& match_rule, | 55 MOCK_METHOD2(AddMatch, void(const std::string& match_rule, |
| 55 DBusError* error)); | 56 DBusError* error)); |
| 56 MOCK_METHOD2(RemoveMatch, bool(const std::string& match_rule, | 57 MOCK_METHOD2(RemoveMatch, bool(const std::string& match_rule, |
| 57 DBusError* error)); | 58 DBusError* error)); |
| 58 MOCK_METHOD4(TryRegisterObjectPath, bool(const ObjectPath& object_path, | 59 MOCK_METHOD4(TryRegisterObjectPath, bool(const ObjectPath& object_path, |
| 59 const DBusObjectPathVTable* vtable, | 60 const DBusObjectPathVTable* vtable, |
| 60 void* user_data, | 61 void* user_data, |
| 61 DBusError* error)); | 62 DBusError* error)); |
| 62 MOCK_METHOD1(UnregisterObjectPath, void(const ObjectPath& object_path)); | 63 MOCK_METHOD1(UnregisterObjectPath, void(const ObjectPath& object_path)); |
| 63 MOCK_METHOD0(GetDBusTaskRunner, base::TaskRunner*()); | 64 MOCK_METHOD0(GetDBusTaskRunner, base::TaskRunner*()); |
| 64 MOCK_METHOD0(GetOriginTaskRunner, base::TaskRunner*()); | 65 MOCK_METHOD0(GetOriginTaskRunner, base::TaskRunner*()); |
| 65 MOCK_METHOD0(HasDBusThread, bool()); | 66 MOCK_METHOD0(HasDBusThread, bool()); |
| 66 MOCK_METHOD0(AssertOnOriginThread, void()); | 67 MOCK_METHOD0(AssertOnOriginThread, void()); |
| 67 MOCK_METHOD0(AssertOnDBusThread, void()); | 68 MOCK_METHOD0(AssertOnDBusThread, void()); |
| 68 | 69 |
| 69 protected: | 70 protected: |
| 70 virtual ~MockBus(); | 71 virtual ~MockBus(); |
| 71 }; | 72 }; |
| 72 | 73 |
| 73 } // namespace dbus | 74 } // namespace dbus |
| 74 | 75 |
| 75 #endif // DBUS_MOCK_BUS_H_ | 76 #endif // DBUS_MOCK_BUS_H_ |
| OLD | NEW |