Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 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 #pragma once | |
| 8 | |
| 9 #include "dbus/bus.h" | |
| 10 #include "testing/gmock/include/gmock/gmock.h" | |
|
stevenjb
2011/08/25 00:12:54
nit: + empty line
satorux1
2011/08/25 05:17:08
Done.
| |
| 11 namespace dbus { | |
| 12 | |
| 13 // Mock for Bus class. Along with MockObjectProxy and MockExportedObject, | |
| 14 // the mock classes can be used to write unit tests without issuing real | |
| 15 // D-Bus calls. | |
| 16 class MockBus : public Bus { | |
| 17 public: | |
| 18 MockBus(Bus::Options& options); | |
| 19 virtual ~MockBus(); | |
| 20 | |
| 21 MOCK_METHOD2(GetObjectProxy, ObjectProxy*(const std::string& service_name, | |
| 22 const std::string& object_path)); | |
| 23 MOCK_METHOD2(GetExportedObject, ExportedObject*( | |
| 24 const std::string& service_name, | |
| 25 const std::string& object_path)); | |
| 26 MOCK_METHOD0(ShutdownAndBlock, void()); | |
| 27 MOCK_METHOD1(Shutdown, void(OnShutdownCallback callback)); | |
| 28 MOCK_METHOD0(Connect, bool()); | |
| 29 MOCK_METHOD1(RequestOwnership, bool(const std::string& service_name)); | |
| 30 MOCK_METHOD1(ReleaseOwnership, bool(const std::string& service_name)); | |
| 31 MOCK_METHOD0(SetUpAsyncOperations, bool()); | |
| 32 MOCK_METHOD3(SendWithReplyAndBlock, DBusMessage*(DBusMessage* request, | |
| 33 int timeout_ms, | |
| 34 DBusError* error)); | |
| 35 MOCK_METHOD3(SendWithReply, void(DBusMessage* request, | |
| 36 DBusPendingCall** pending_call, | |
| 37 int timeout_ms)); | |
| 38 MOCK_METHOD2(Send, void(DBusMessage* request, | |
| 39 uint32* serial)); | |
| 40 MOCK_METHOD2(AddFilter, void(DBusHandleMessageFunction handle_message, | |
| 41 void* user_data)); | |
| 42 MOCK_METHOD2(RemoveFilter, void(DBusHandleMessageFunction handle_message, | |
| 43 void* user_data)); | |
| 44 MOCK_METHOD2(AddMatch, void(const std::string& match_rule, | |
| 45 DBusError* error)); | |
| 46 MOCK_METHOD2(RemoveMatch, void(const std::string& match_rule, | |
| 47 DBusError* error)); | |
| 48 MOCK_METHOD4(TryRegisterObjectPath, bool(const std::string& object_path, | |
| 49 const DBusObjectPathVTable* vtable, | |
| 50 void* user_data, | |
| 51 DBusError* error)); | |
| 52 MOCK_METHOD1(UnregisterObjectPath, void(const std::string& object_path)); | |
| 53 MOCK_METHOD2(PostTaskToOriginThread, void( | |
| 54 const tracked_objects::Location& from_here, | |
| 55 const base::Closure& task)); | |
| 56 MOCK_METHOD2(PostTaskToDBusThread, void( | |
| 57 const tracked_objects::Location& from_here, | |
| 58 const base::Closure& task)); | |
| 59 MOCK_METHOD3(PostDelayedTaskToDBusThread, void( | |
| 60 const tracked_objects::Location& from_here, | |
| 61 const base::Closure& task, | |
| 62 int delay_ms)); | |
| 63 MOCK_METHOD0(HasDBusThread, bool()); | |
| 64 MOCK_METHOD0(AssertOnOriginThread, void()); | |
| 65 MOCK_METHOD0(AssertOnDBusThread, void()); | |
| 66 }; | |
| 67 | |
| 68 } // namespace dbus | |
| 69 | |
| 70 #endif // DBUS_MOCK_BUS_H_ | |
| OLD | NEW |