Darin Petkov | 36a3ace | 2012-03-06 17:22:14 +0100 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Darin Petkov | f7897bc | 2011-06-08 17:13:36 -0700 | [diff] [blame] | 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 SHILL_MOCK_GLIB_H_ |
| 6 | #define SHILL_MOCK_GLIB_H_ |
| 7 | |
Darin Petkov | 1bdedf1 | 2011-08-26 13:32:11 -0700 | [diff] [blame] | 8 | #include <base/basictypes.h> |
Darin Petkov | f7897bc | 2011-06-08 17:13:36 -0700 | [diff] [blame] | 9 | #include <gmock/gmock.h> |
| 10 | |
Darin Petkov | 3258a81 | 2011-06-23 11:28:45 -0700 | [diff] [blame] | 11 | #include "shill/glib.h" |
Darin Petkov | f7897bc | 2011-06-08 17:13:36 -0700 | [diff] [blame] | 12 | |
| 13 | namespace shill { |
| 14 | |
Darin Petkov | 3258a81 | 2011-06-23 11:28:45 -0700 | [diff] [blame] | 15 | class MockGLib : public GLib { |
Darin Petkov | f7897bc | 2011-06-08 17:13:36 -0700 | [diff] [blame] | 16 | public: |
Darin Petkov | 1bdedf1 | 2011-08-26 13:32:11 -0700 | [diff] [blame] | 17 | MockGLib(); |
| 18 | virtual ~MockGLib(); |
| 19 | |
Darin Petkov | 823c47e | 2011-06-27 16:15:35 -0700 | [diff] [blame] | 20 | MOCK_METHOD2(Base64Decode, guchar *(const gchar *text, gsize *out_len)); |
| 21 | MOCK_METHOD2(Base64Encode, gchar *(const guchar *data, gsize len)); |
Darin Petkov | 887f298 | 2011-07-14 16:10:17 -0700 | [diff] [blame] | 22 | MOCK_METHOD1(BusUnwatchName, void(guint watcher_id)); |
| 23 | MOCK_METHOD7(BusWatchName, |
| 24 | guint(GBusType bus_type, |
| 25 | const gchar *name, |
| 26 | GBusNameWatcherFlags flags, |
| 27 | GBusNameAppearedCallback name_appeared_handler, |
| 28 | GBusNameVanishedCallback name_vanished_handler, |
| 29 | gpointer user_data, |
| 30 | GDestroyNotify user_data_free_func)); |
Darin Petkov | 92c4390 | 2011-06-09 20:46:06 -0700 | [diff] [blame] | 31 | MOCK_METHOD3(ChildWatchAdd, guint(GPid pid, |
| 32 | GChildWatchFunc function, |
| 33 | gpointer data)); |
Darin Petkov | 083047b | 2011-06-23 20:42:48 -0700 | [diff] [blame] | 34 | MOCK_METHOD1(Free, void(gpointer mem)); |
| 35 | MOCK_METHOD1(KeyFileFree, void(GKeyFile *key_file)); |
| 36 | MOCK_METHOD4(KeyFileGetBoolean, gboolean(GKeyFile *key_file, |
| 37 | const gchar *group_name, |
| 38 | const gchar *key, |
| 39 | GError **error)); |
| 40 | MOCK_METHOD2(KeyFileGetGroups, gchar **(GKeyFile *key_file, |
| 41 | gsize *length)); |
| 42 | MOCK_METHOD4(KeyFileGetInteger, gint(GKeyFile *key_file, |
| 43 | const gchar *group_name, |
| 44 | const gchar *key, |
| 45 | GError **error)); |
| 46 | MOCK_METHOD4(KeyFileGetString, gchar *(GKeyFile *key_file, |
| 47 | const gchar *group_name, |
| 48 | const gchar *key, |
| 49 | GError **error)); |
Darin Petkov | b2841fd | 2011-06-30 12:54:12 -0700 | [diff] [blame] | 50 | MOCK_METHOD5(KeyFileGetStringList, gchar **(GKeyFile *key_file, |
| 51 | const gchar *group_name, |
| 52 | const gchar *key, |
| 53 | gsize *length, |
| 54 | GError **error)); |
Darin Petkov | 083047b | 2011-06-23 20:42:48 -0700 | [diff] [blame] | 55 | MOCK_METHOD2(KeyFileHasGroup, gboolean(GKeyFile *key_file, |
| 56 | const gchar *group_name)); |
Paul Stewart | a41e38d | 2011-11-11 07:47:29 -0800 | [diff] [blame] | 57 | MOCK_METHOD4(KeyFileHasKey, gboolean(GKeyFile *key_file, |
| 58 | const gchar *group_name, |
| 59 | const gchar *key, |
| 60 | GError **error)); |
Darin Petkov | 083047b | 2011-06-23 20:42:48 -0700 | [diff] [blame] | 61 | MOCK_METHOD4(KeyFileLoadFromFile, gboolean(GKeyFile *key_file, |
| 62 | const gchar *file, |
| 63 | GKeyFileFlags flags, |
| 64 | GError **error)); |
| 65 | MOCK_METHOD0(KeyFileNew, GKeyFile *()); |
| 66 | MOCK_METHOD3(KeyFileRemoveGroup, void(GKeyFile *key_file, |
| 67 | const gchar *group_name, |
| 68 | GError **error)); |
| 69 | MOCK_METHOD4(KeyFileRemoveKey, void(GKeyFile *key_file, |
| 70 | const gchar *group_name, |
| 71 | const gchar *key, |
| 72 | GError **error)); |
| 73 | MOCK_METHOD4(KeyFileSetBoolean, void(GKeyFile *key_file, |
| 74 | const gchar *group_name, |
| 75 | const gchar *key, |
| 76 | gboolean value)); |
Paul Stewart | 5dc40aa | 2011-10-28 19:43:43 -0700 | [diff] [blame] | 77 | MOCK_METHOD5(KeyFileSetComment, gboolean(GKeyFile *key_file, |
| 78 | const gchar *group_name, |
| 79 | const gchar *key, |
| 80 | const gchar *comment, |
| 81 | GError **error)); |
Darin Petkov | 083047b | 2011-06-23 20:42:48 -0700 | [diff] [blame] | 82 | MOCK_METHOD4(KeyFileSetInteger, void(GKeyFile *key_file, |
| 83 | const gchar *group_name, |
| 84 | const gchar *key, |
| 85 | gint value)); |
| 86 | MOCK_METHOD4(KeyFileSetString, void(GKeyFile *key_file, |
| 87 | const gchar *group_name, |
| 88 | const gchar *key, |
Hristo Stefanov | ed2c28c | 2011-11-29 15:37:30 -0800 | [diff] [blame] | 89 | const gchar *value)); |
Darin Petkov | b2841fd | 2011-06-30 12:54:12 -0700 | [diff] [blame] | 90 | MOCK_METHOD5(KeyFileSetStringList, void(GKeyFile *key_file, |
| 91 | const gchar *group_name, |
| 92 | const gchar *key, |
| 93 | const gchar * const list[], |
| 94 | gsize length)); |
Darin Petkov | 083047b | 2011-06-23 20:42:48 -0700 | [diff] [blame] | 95 | MOCK_METHOD3(KeyFileToData, gchar *(GKeyFile *key_file, |
| 96 | gsize *length, |
| 97 | GError **error)); |
Darin Petkov | 92c4390 | 2011-06-09 20:46:06 -0700 | [diff] [blame] | 98 | MOCK_METHOD1(SourceRemove, gboolean(guint tag)); |
Darin Petkov | f7897bc | 2011-06-08 17:13:36 -0700 | [diff] [blame] | 99 | MOCK_METHOD8(SpawnAsync, gboolean(const gchar *working_directory, |
| 100 | gchar **argv, |
| 101 | gchar **envp, |
| 102 | GSpawnFlags flags, |
| 103 | GSpawnChildSetupFunc child_setup, |
| 104 | gpointer user_data, |
| 105 | GPid *child_pid, |
| 106 | GError **error)); |
Darin Petkov | 36a3ace | 2012-03-06 17:22:14 +0100 | [diff] [blame] | 107 | MOCK_METHOD10(SpawnAsyncWithPipesCWD, |
| 108 | gboolean(gchar **argv, |
| 109 | gchar **envp, |
| 110 | GSpawnFlags flags, |
| 111 | GSpawnChildSetupFunc child_setup, |
| 112 | gpointer user_data, |
| 113 | GPid *child_pid, |
| 114 | gint *standard_input, |
| 115 | gint *standard_output, |
| 116 | gint *standard_error, |
| 117 | GError **error)); |
Darin Petkov | 92c4390 | 2011-06-09 20:46:06 -0700 | [diff] [blame] | 118 | MOCK_METHOD1(SpawnClosePID, void(GPid pid)); |
Darin Petkov | 3c5e4dc | 2012-04-02 14:44:27 +0200 | [diff] [blame] | 119 | MOCK_METHOD10(SpawnSync, gboolean(const gchar *working_directory, |
| 120 | gchar **argv, |
| 121 | gchar **envp, |
| 122 | GSpawnFlags flags, |
| 123 | GSpawnChildSetupFunc child_setup, |
| 124 | gpointer user_data, |
| 125 | gchar **standard_output, |
| 126 | gchar **standard_error, |
| 127 | gint *exit_status, |
| 128 | GError **error)); |
Darin Petkov | 083047b | 2011-06-23 20:42:48 -0700 | [diff] [blame] | 129 | MOCK_METHOD1(Strfreev, void(gchar **str_array)); |
Darin Petkov | 887f298 | 2011-07-14 16:10:17 -0700 | [diff] [blame] | 130 | MOCK_METHOD0(TypeInit, void()); |
Darin Petkov | 1bdedf1 | 2011-08-26 13:32:11 -0700 | [diff] [blame] | 131 | |
| 132 | private: |
| 133 | DISALLOW_COPY_AND_ASSIGN(MockGLib); |
Darin Petkov | f7897bc | 2011-06-08 17:13:36 -0700 | [diff] [blame] | 134 | }; |
| 135 | |
| 136 | } // namespace shill |
| 137 | |
| 138 | #endif // SHILL_MOCK_GLIB_H_ |