Darin Petkov | f7897bc | 2011-06-08 17:13:36 -0700 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium OS 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 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)); |
| 57 | MOCK_METHOD4(KeyFileLoadFromFile, gboolean(GKeyFile *key_file, |
| 58 | const gchar *file, |
| 59 | GKeyFileFlags flags, |
| 60 | GError **error)); |
| 61 | MOCK_METHOD0(KeyFileNew, GKeyFile *()); |
| 62 | MOCK_METHOD3(KeyFileRemoveGroup, void(GKeyFile *key_file, |
| 63 | const gchar *group_name, |
| 64 | GError **error)); |
| 65 | MOCK_METHOD4(KeyFileRemoveKey, void(GKeyFile *key_file, |
| 66 | const gchar *group_name, |
| 67 | const gchar *key, |
| 68 | GError **error)); |
| 69 | MOCK_METHOD4(KeyFileSetBoolean, void(GKeyFile *key_file, |
| 70 | const gchar *group_name, |
| 71 | const gchar *key, |
| 72 | gboolean value)); |
| 73 | MOCK_METHOD4(KeyFileSetInteger, void(GKeyFile *key_file, |
| 74 | const gchar *group_name, |
| 75 | const gchar *key, |
| 76 | gint value)); |
| 77 | MOCK_METHOD4(KeyFileSetString, void(GKeyFile *key_file, |
| 78 | const gchar *group_name, |
| 79 | const gchar *key, |
| 80 | const gchar *string)); |
Darin Petkov | b2841fd | 2011-06-30 12:54:12 -0700 | [diff] [blame] | 81 | MOCK_METHOD5(KeyFileSetStringList, void(GKeyFile *key_file, |
| 82 | const gchar *group_name, |
| 83 | const gchar *key, |
| 84 | const gchar * const list[], |
| 85 | gsize length)); |
Darin Petkov | 083047b | 2011-06-23 20:42:48 -0700 | [diff] [blame] | 86 | MOCK_METHOD3(KeyFileToData, gchar *(GKeyFile *key_file, |
| 87 | gsize *length, |
| 88 | GError **error)); |
Darin Petkov | 92c4390 | 2011-06-09 20:46:06 -0700 | [diff] [blame] | 89 | MOCK_METHOD1(SourceRemove, gboolean(guint tag)); |
Darin Petkov | f7897bc | 2011-06-08 17:13:36 -0700 | [diff] [blame] | 90 | MOCK_METHOD8(SpawnAsync, gboolean(const gchar *working_directory, |
| 91 | gchar **argv, |
| 92 | gchar **envp, |
| 93 | GSpawnFlags flags, |
| 94 | GSpawnChildSetupFunc child_setup, |
| 95 | gpointer user_data, |
| 96 | GPid *child_pid, |
| 97 | GError **error)); |
Darin Petkov | 92c4390 | 2011-06-09 20:46:06 -0700 | [diff] [blame] | 98 | MOCK_METHOD1(SpawnClosePID, void(GPid pid)); |
Darin Petkov | 083047b | 2011-06-23 20:42:48 -0700 | [diff] [blame] | 99 | MOCK_METHOD1(Strfreev, void(gchar **str_array)); |
Darin Petkov | 887f298 | 2011-07-14 16:10:17 -0700 | [diff] [blame] | 100 | MOCK_METHOD0(TypeInit, void()); |
Darin Petkov | 1bdedf1 | 2011-08-26 13:32:11 -0700 | [diff] [blame] | 101 | |
| 102 | private: |
| 103 | DISALLOW_COPY_AND_ASSIGN(MockGLib); |
Darin Petkov | f7897bc | 2011-06-08 17:13:36 -0700 | [diff] [blame] | 104 | }; |
| 105 | |
| 106 | } // namespace shill |
| 107 | |
| 108 | #endif // SHILL_MOCK_GLIB_H_ |