blob: f82aad828ce6b322d2093736e6b01874e5c808a0 [file] [log] [blame]
Darin Petkov36a3ace2012-03-06 17:22:14 +01001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Darin Petkovf7897bc2011-06-08 17:13:36 -07002// 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 Petkov1bdedf12011-08-26 13:32:11 -07008#include <base/basictypes.h>
Darin Petkovf7897bc2011-06-08 17:13:36 -07009#include <gmock/gmock.h>
10
Darin Petkov3258a812011-06-23 11:28:45 -070011#include "shill/glib.h"
Darin Petkovf7897bc2011-06-08 17:13:36 -070012
13namespace shill {
14
Darin Petkov3258a812011-06-23 11:28:45 -070015class MockGLib : public GLib {
Darin Petkovf7897bc2011-06-08 17:13:36 -070016 public:
Darin Petkov1bdedf12011-08-26 13:32:11 -070017 MockGLib();
18 virtual ~MockGLib();
19
Darin Petkov823c47e2011-06-27 16:15:35 -070020 MOCK_METHOD2(Base64Decode, guchar *(const gchar *text, gsize *out_len));
21 MOCK_METHOD2(Base64Encode, gchar *(const guchar *data, gsize len));
Christopher Wiley5447d2e2013-03-19 17:46:03 -070022 MOCK_METHOD2(B64Decode, bool(const std::string &input, std::string *output));
23 MOCK_METHOD2(B64Encode, bool(const std::string &input, std::string *output));
Darin Petkov887f2982011-07-14 16:10:17 -070024 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 Petkov92c43902011-06-09 20:46:06 -070033 MOCK_METHOD3(ChildWatchAdd, guint(GPid pid,
34 GChildWatchFunc function,
35 gpointer data));
Darin Petkov083047b2011-06-23 20:42:48 -070036 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 Petkovb2841fd2011-06-30 12:54:12 -070052 MOCK_METHOD5(KeyFileGetStringList, gchar **(GKeyFile *key_file,
53 const gchar *group_name,
54 const gchar *key,
55 gsize *length,
56 GError **error));
Darin Petkov083047b2011-06-23 20:42:48 -070057 MOCK_METHOD2(KeyFileHasGroup, gboolean(GKeyFile *key_file,
58 const gchar *group_name));
Paul Stewarta41e38d2011-11-11 07:47:29 -080059 MOCK_METHOD4(KeyFileHasKey, gboolean(GKeyFile *key_file,
60 const gchar *group_name,
61 const gchar *key,
62 GError **error));
Darin Petkov083047b2011-06-23 20:42:48 -070063 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 Stewart5dc40aa2011-10-28 19:43:43 -070079 MOCK_METHOD5(KeyFileSetComment, gboolean(GKeyFile *key_file,
80 const gchar *group_name,
81 const gchar *key,
82 const gchar *comment,
83 GError **error));
Darin Petkov083047b2011-06-23 20:42:48 -070084 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 Stefanoved2c28c2011-11-29 15:37:30 -080091 const gchar *value));
Darin Petkovb2841fd2011-06-30 12:54:12 -070092 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 Petkov083047b2011-06-23 20:42:48 -070097 MOCK_METHOD3(KeyFileToData, gchar *(GKeyFile *key_file,
98 gsize *length,
99 GError **error));
Darin Petkov92c43902011-06-09 20:46:06 -0700100 MOCK_METHOD1(SourceRemove, gboolean(guint tag));
Darin Petkovf7897bc2011-06-08 17:13:36 -0700101 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 Petkov92c43902011-06-09 20:46:06 -0700109 MOCK_METHOD1(SpawnClosePID, void(GPid pid));
Darin Petkov3c5e4dc2012-04-02 14:44:27 +0200110 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 Petkov083047b2011-06-23 20:42:48 -0700120 MOCK_METHOD1(Strfreev, void(gchar **str_array));
Darin Petkov887f2982011-07-14 16:10:17 -0700121 MOCK_METHOD0(TypeInit, void());
Darin Petkov1bdedf12011-08-26 13:32:11 -0700122
123 private:
124 DISALLOW_COPY_AND_ASSIGN(MockGLib);
Darin Petkovf7897bc2011-06-08 17:13:36 -0700125};
126
127} // namespace shill
128
129#endif // SHILL_MOCK_GLIB_H_