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(); | |
22 | 21 |
23 MOCK_METHOD2(GetObjectProxy, ObjectProxy*(const std::string& service_name, | 22 MOCK_METHOD2(GetObjectProxy, ObjectProxy*(const std::string& service_name, |
24 const ObjectPath& object_path)); | 23 const ObjectPath& object_path)); |
25 MOCK_METHOD3(GetObjectProxyWithOptions, | 24 MOCK_METHOD3(GetObjectProxyWithOptions, |
26 ObjectProxy*(const std::string& service_name, | 25 ObjectProxy*(const std::string& service_name, |
27 const ObjectPath& object_path, | 26 const ObjectPath& object_path, |
28 int options)); | 27 int options)); |
29 MOCK_METHOD1(GetExportedObject, ExportedObject*( | 28 MOCK_METHOD1(GetExportedObject, ExportedObject*( |
30 const ObjectPath& object_path)); | 29 const ObjectPath& object_path)); |
31 MOCK_METHOD0(ShutdownAndBlock, void()); | 30 MOCK_METHOD0(ShutdownAndBlock, void()); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 MOCK_METHOD2(PostTaskToDBusThread, void( | 63 MOCK_METHOD2(PostTaskToDBusThread, void( |
65 const tracked_objects::Location& from_here, | 64 const tracked_objects::Location& from_here, |
66 const base::Closure& task)); | 65 const base::Closure& task)); |
67 MOCK_METHOD3(PostDelayedTaskToDBusThread, void( | 66 MOCK_METHOD3(PostDelayedTaskToDBusThread, void( |
68 const tracked_objects::Location& from_here, | 67 const tracked_objects::Location& from_here, |
69 const base::Closure& task, | 68 const base::Closure& task, |
70 base::TimeDelta delay)); | 69 base::TimeDelta delay)); |
71 MOCK_METHOD0(HasDBusThread, bool()); | 70 MOCK_METHOD0(HasDBusThread, bool()); |
72 MOCK_METHOD0(AssertOnOriginThread, void()); | 71 MOCK_METHOD0(AssertOnOriginThread, void()); |
73 MOCK_METHOD0(AssertOnDBusThread, void()); | 72 MOCK_METHOD0(AssertOnDBusThread, void()); |
| 73 |
| 74 protected: |
| 75 virtual ~MockBus(); |
74 }; | 76 }; |
75 | 77 |
76 } // namespace dbus | 78 } // namespace dbus |
77 | 79 |
78 #endif // DBUS_MOCK_BUS_H_ | 80 #endif // DBUS_MOCK_BUS_H_ |
OLD | NEW |