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