blob: fea6056eafdbabd9391448edb177e18962e9c7a4 [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_H_
6#define SHILL_GLIB_H_
7
Darin Petkov3258a812011-06-23 11:28:45 -07008#include <glib.h>
Darin Petkovf7897bc2011-06-08 17:13:36 -07009
10namespace shill {
11
Darin Petkov3258a812011-06-23 11:28:45 -070012// A GLib abstraction allowing GLib mocking in tests.
13class GLib {
Darin Petkovf7897bc2011-06-08 17:13:36 -070014 public:
Darin Petkov3258a812011-06-23 11:28:45 -070015 virtual ~GLib();
16
17 // g_child_watch_add
Darin Petkov92c43902011-06-09 20:46:06 -070018 virtual guint ChildWatchAdd(GPid pid,
19 GChildWatchFunc function,
20 gpointer data);
Darin Petkov3258a812011-06-23 11:28:45 -070021 // g_source_remove
Darin Petkov92c43902011-06-09 20:46:06 -070022 virtual gboolean SourceRemove(guint tag);
Darin Petkov3258a812011-06-23 11:28:45 -070023 // g_spawn_async
Darin Petkovf7897bc2011-06-08 17:13:36 -070024 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);
Darin Petkov3258a812011-06-23 11:28:45 -070032 // g_spawn_close_pid
Darin Petkov92c43902011-06-09 20:46:06 -070033 virtual void SpawnClosePID(GPid pid);
Darin Petkovf7897bc2011-06-08 17:13:36 -070034};
35
36} // namespace shill
37
38#endif // SHILL_GLIB_H_