blob: d51944182e6902882b27bafb4165c0f2d3adb282 [file] [log] [blame]
Darin Petkovf7897bc2011-06-08 17:13:36 -07001// 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 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));
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 Petkovb2841fd2011-06-30 12:54:12 -070081 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 Petkov083047b2011-06-23 20:42:48 -070086 MOCK_METHOD3(KeyFileToData, gchar *(GKeyFile *key_file,
87 gsize *length,
88 GError **error));
Darin Petkov92c43902011-06-09 20:46:06 -070089 MOCK_METHOD1(SourceRemove, gboolean(guint tag));
Darin Petkovf7897bc2011-06-08 17:13:36 -070090 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 Petkov92c43902011-06-09 20:46:06 -070098 MOCK_METHOD1(SpawnClosePID, void(GPid pid));
Darin Petkov083047b2011-06-23 20:42:48 -070099 MOCK_METHOD1(Strfreev, void(gchar **str_array));
Darin Petkov887f2982011-07-14 16:10:17 -0700100 MOCK_METHOD0(TypeInit, void());
Darin Petkov1bdedf12011-08-26 13:32:11 -0700101
102 private:
103 DISALLOW_COPY_AND_ASSIGN(MockGLib);
Darin Petkovf7897bc2011-06-08 17:13:36 -0700104};
105
106} // namespace shill
107
108#endif // SHILL_MOCK_GLIB_H_