blob: b9b10e967108051fbf84d7a52e848d3836cd0581 [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));
Darin Petkov887f2982011-07-14 16:10:17 -070022 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 Petkov92c43902011-06-09 20:46:06 -070031 MOCK_METHOD3(ChildWatchAdd, guint(GPid pid,
32 GChildWatchFunc function,
33 gpointer data));
Darin Petkov083047b2011-06-23 20:42:48 -070034 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 Petkovb2841fd2011-06-30 12:54:12 -070050 MOCK_METHOD5(KeyFileGetStringList, gchar **(GKeyFile *key_file,
51 const gchar *group_name,
52 const gchar *key,
53 gsize *length,
54 GError **error));
Darin Petkov083047b2011-06-23 20:42:48 -070055 MOCK_METHOD2(KeyFileHasGroup, gboolean(GKeyFile *key_file,
56 const gchar *group_name));
Paul Stewarta41e38d2011-11-11 07:47:29 -080057 MOCK_METHOD4(KeyFileHasKey, gboolean(GKeyFile *key_file,
58 const gchar *group_name,
59 const gchar *key,
60 GError **error));
Darin Petkov083047b2011-06-23 20:42:48 -070061 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 Stewart5dc40aa2011-10-28 19:43:43 -070077 MOCK_METHOD5(KeyFileSetComment, gboolean(GKeyFile *key_file,
78 const gchar *group_name,
79 const gchar *key,
80 const gchar *comment,
81 GError **error));
Darin Petkov083047b2011-06-23 20:42:48 -070082 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 Stefanoved2c28c2011-11-29 15:37:30 -080089 const gchar *value));
Darin Petkovb2841fd2011-06-30 12:54:12 -070090 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 Petkov083047b2011-06-23 20:42:48 -070095 MOCK_METHOD3(KeyFileToData, gchar *(GKeyFile *key_file,
96 gsize *length,
97 GError **error));
Darin Petkov92c43902011-06-09 20:46:06 -070098 MOCK_METHOD1(SourceRemove, gboolean(guint tag));
Darin Petkovf7897bc2011-06-08 17:13:36 -070099 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 Petkov36a3ace2012-03-06 17:22:14 +0100107 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 Petkov92c43902011-06-09 20:46:06 -0700118 MOCK_METHOD1(SpawnClosePID, void(GPid pid));
Darin Petkov3c5e4dc2012-04-02 14:44:27 +0200119 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 Petkov083047b2011-06-23 20:42:48 -0700129 MOCK_METHOD1(Strfreev, void(gchar **str_array));
Darin Petkov887f2982011-07-14 16:10:17 -0700130 MOCK_METHOD0(TypeInit, void());
Darin Petkov1bdedf12011-08-26 13:32:11 -0700131
132 private:
133 DISALLOW_COPY_AND_ASSIGN(MockGLib);
Darin Petkovf7897bc2011-06-08 17:13:36 -0700134};
135
136} // namespace shill
137
138#endif // SHILL_MOCK_GLIB_H_