OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 CHROMEOS_PLATFORM_UPDATE_ENGINE_MOCK_DBUS_INTERFACE_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_MOCK_DBUS_INTERFACE_H__ |
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_MOCK_DBUS_INTERFACE_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_MOCK_DBUS_INTERFACE_H__ |
7 | 7 |
8 #include <gmock/gmock.h> | 8 #include <gmock/gmock.h> |
9 | 9 |
10 #include "update_engine/dbus_interface.h" | 10 #include "update_engine/dbus_interface.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 GType var_arg1, | 30 GType var_arg1, |
31 GHashTable** var_arg2, | 31 GHashTable** var_arg2, |
32 GType var_arg3)); | 32 GType var_arg3)); |
33 MOCK_METHOD10(ProxyCall, gboolean(DBusGProxy* proxy, | 33 MOCK_METHOD10(ProxyCall, gboolean(DBusGProxy* proxy, |
34 const char* method, | 34 const char* method, |
35 GError** error, | 35 GError** error, |
36 GType var_arg1, const char* var_arg2, | 36 GType var_arg1, const char* var_arg2, |
37 GType var_arg3, | 37 GType var_arg3, |
38 GType var_arg4, gchar** var_arg5, | 38 GType var_arg4, gchar** var_arg5, |
39 GType var_arg6, GArray** var_arg7)); | 39 GType var_arg6, GArray** var_arg7)); |
| 40 MOCK_METHOD10(ProxyCall, gboolean(DBusGProxy* proxy, |
| 41 const char* method, |
| 42 GError** error, |
| 43 GType var_arg1, const char* var_arg2, |
| 44 GType var_arg3, const char* var_arg4, |
| 45 GType var_arg5, const char* var_arg6, |
| 46 GType var_arg7)); |
| 47 |
| 48 MOCK_METHOD1(ConnectionGetConnection, DBusConnection*(DBusGConnection* gbus)); |
| 49 |
| 50 MOCK_METHOD3(DbusBusAddMatch, void(DBusConnection* connection, |
| 51 const char* rule, |
| 52 DBusError* error)); |
| 53 |
| 54 MOCK_METHOD4(DbusConnectionAddFilter, dbus_bool_t( |
| 55 DBusConnection* connection, |
| 56 DBusHandleMessageFunction function, |
| 57 void* user_data, |
| 58 DBusFreeFunction free_data_function)); |
| 59 |
| 60 MOCK_METHOD3(DbusConnectionRemoveFilter, void( |
| 61 DBusConnection* connection, |
| 62 DBusHandleMessageFunction function, |
| 63 void* user_data)); |
| 64 |
| 65 MOCK_METHOD3(DbusMessageIsSignal, dbus_bool_t(DBusMessage* message, |
| 66 const char* interface, |
| 67 const char* signal_name)); |
| 68 |
| 69 MOCK_METHOD9(DbusMessageGetArgs, dbus_bool_t( |
| 70 DBusMessage* message, |
| 71 DBusError* error, |
| 72 GType var_arg1, char** var_arg2, |
| 73 GType var_arg3, char** var_arg4, |
| 74 GType var_arg5, char** var_arg6, |
| 75 GType var_arg7)); |
40 | 76 |
41 // Since gmock only supports mocking functions up to 10 args, we | 77 // Since gmock only supports mocking functions up to 10 args, we |
42 // take the 11-arg function we'd like to mock, drop the last arg | 78 // take the 11-arg function we'd like to mock, drop the last arg |
43 // and call the 10-arg version. Dropping the last arg isn't ideal, | 79 // and call the 10-arg version. Dropping the last arg isn't ideal, |
44 // but this is a lot better than nothing. | 80 // but this is a lot better than nothing. |
45 gboolean ProxyCall(DBusGProxy* proxy, | 81 gboolean ProxyCall(DBusGProxy* proxy, |
46 const char* method, | 82 const char* method, |
47 GError** error, | 83 GError** error, |
48 GType var_arg1, const char* var_arg2, | 84 GType var_arg1, const char* var_arg2, |
49 GType var_arg3, | 85 GType var_arg3, |
50 GType var_arg4, gchar** var_arg5, | 86 GType var_arg4, gchar** var_arg5, |
51 GType var_arg6, GArray** var_arg7, | 87 GType var_arg6, GArray** var_arg7, |
52 GType var_arg8) { | 88 GType var_arg8) { |
53 return ProxyCall(proxy, | 89 return ProxyCall(proxy, |
54 method, | 90 method, |
55 error, | 91 error, |
| 92 var_arg1, var_arg2, |
| 93 var_arg3, |
| 94 var_arg4, var_arg5, |
| 95 var_arg6, var_arg7); |
| 96 } |
| 97 gboolean ProxyCall(DBusGProxy* proxy, |
| 98 const char* method, |
| 99 GError** error, |
| 100 GType var_arg1, const char* var_arg2, |
| 101 GType var_arg3, const char* var_arg4, |
| 102 GType var_arg5, const char* var_arg6, |
| 103 GType var_arg7, GType var_arg8) { |
| 104 return ProxyCall(proxy, |
| 105 method, |
| 106 error, |
56 var_arg1, var_arg2, | 107 var_arg1, var_arg2, |
57 var_arg3, | 108 var_arg3, |
58 var_arg4, var_arg5, | 109 var_arg4, var_arg5, |
59 var_arg6, var_arg7); | 110 var_arg6, var_arg7); |
60 } | 111 } |
61 }; | 112 }; |
62 | 113 |
63 } // namespace chromeos_update_engine | 114 } // namespace chromeos_update_engine |
64 | 115 |
65 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_MOCK_DBUS_INTERFACE_H__ | 116 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_MOCK_DBUS_INTERFACE_H__ |
OLD | NEW |