| 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 "dbus/bus.h" | 8 #include "dbus/bus.h" |
| 9 #include "dbus/object_path.h" | 9 #include "dbus/object_path.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| 11 | 11 |
| 12 namespace dbus { | 12 namespace dbus { |
| 13 | 13 |
| 14 // Mock for Bus class. Along with MockObjectProxy and MockExportedObject, | 14 // Mock for Bus class. Along with MockObjectProxy and MockExportedObject, |
| 15 // the mock classes can be used to write unit tests without issuing real | 15 // the mock classes can be used to write unit tests without issuing real |
| 16 // D-Bus calls. | 16 // D-Bus calls. |
| 17 class MockBus : public Bus { | 17 class MockBus : public Bus { |
| 18 public: | 18 public: |
| 19 MockBus(const Bus::Options& options); | 19 MockBus(const Bus::Options& options); |
| 20 | 20 |
| 21 MOCK_METHOD2(GetObjectProxy, ObjectProxy*(const std::string& service_name, | 21 MOCK_METHOD2(GetObjectProxy, ObjectProxy*(const std::string& service_name, |
| 22 const ObjectPath& object_path)); | 22 const ObjectPath& object_path)); |
| 23 MOCK_METHOD3(GetObjectProxyWithOptions, | 23 MOCK_METHOD3(GetObjectProxyWithOptions, |
| 24 ObjectProxy*(const std::string& service_name, | 24 ObjectProxy*(const std::string& service_name, |
| 25 const ObjectPath& object_path, | 25 const ObjectPath& object_path, |
| 26 int options)); | 26 int options)); |
| 27 MOCK_METHOD1(GetExportedObject, ExportedObject*( | 27 MOCK_METHOD1(GetExportedObject, ExportedObject*( |
| 28 const ObjectPath& object_path)); | 28 const ObjectPath& object_path)); |
| 29 MOCK_METHOD2(GetObjectManager, ObjectManager*(const std::string&, |
| 30 const ObjectPath&)); |
| 29 MOCK_METHOD0(ShutdownAndBlock, void()); | 31 MOCK_METHOD0(ShutdownAndBlock, void()); |
| 30 MOCK_METHOD0(ShutdownOnDBusThreadAndBlock, void()); | 32 MOCK_METHOD0(ShutdownOnDBusThreadAndBlock, void()); |
| 31 MOCK_METHOD0(Connect, bool()); | 33 MOCK_METHOD0(Connect, bool()); |
| 32 MOCK_METHOD2(RequestOwnership, void( | 34 MOCK_METHOD2(RequestOwnership, void( |
| 33 const std::string& service_name, | 35 const std::string& service_name, |
| 34 OnOwnershipCallback on_ownership_callback)); | 36 OnOwnershipCallback on_ownership_callback)); |
| 35 MOCK_METHOD1(RequestOwnershipAndBlock, bool(const std::string& service_name)); | 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, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 MOCK_METHOD0(AssertOnOriginThread, void()); | 72 MOCK_METHOD0(AssertOnOriginThread, void()); |
| 71 MOCK_METHOD0(AssertOnDBusThread, void()); | 73 MOCK_METHOD0(AssertOnDBusThread, void()); |
| 72 | 74 |
| 73 protected: | 75 protected: |
| 74 virtual ~MockBus(); | 76 virtual ~MockBus(); |
| 75 }; | 77 }; |
| 76 | 78 |
| 77 } // namespace dbus | 79 } // namespace dbus |
| 78 | 80 |
| 79 #endif // DBUS_MOCK_BUS_H_ | 81 #endif // DBUS_MOCK_BUS_H_ |
| OLD | NEW |