blob: 9017d1de2c5c83fd79947ce454e461dcb2bc007e [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_GLIB_INTERFACE_H_
6#define SHILL_GLIB_INTERFACE_H_
7
8#include <glib.h>
9
10namespace shill {
11
12// A virtual GLib interface allowing GLib mocking in tests.
13class GLibInterface {
14 public:
15 virtual ~GLibInterface() {}
16
Darin Petkov92c43902011-06-09 20:46:06 -070017 // g_child_watch_add
18 virtual guint ChildWatchAdd(GPid pid,
19 GChildWatchFunc function,
20 gpointer data) = 0;
21 // g_source_remove
22 virtual gboolean SourceRemove(guint tag) = 0;
Darin Petkovf7897bc2011-06-08 17:13:36 -070023 // g_spawn_async
24 virtual gboolean SpawnAsync(const gchar *working_directory,
25 gchar **argv,
26 gchar **envp,
27 GSpawnFlags flags,
28 GSpawnChildSetupFunc child_setup,
29 gpointer user_data,
30 GPid *child_pid,
31 GError **error) = 0;
Darin Petkov92c43902011-06-09 20:46:06 -070032 // g_spawn_close_pid
33 virtual void SpawnClosePID(GPid pid) = 0;
Darin Petkovf7897bc2011-06-08 17:13:36 -070034};
35
36} // namespace shill
37
38#endif // SHILL_GLIB_INTERFACE_H_