Darin Petkov | f7897bc | 2011-06-08 17:13:36 -0700 | [diff] [blame] | 1 | // 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 | |
| 10 | namespace shill { |
| 11 | |
| 12 | // A virtual GLib interface allowing GLib mocking in tests. |
| 13 | class GLibInterface { |
| 14 | public: |
| 15 | virtual ~GLibInterface() {} |
| 16 | |
Darin Petkov | 92c4390 | 2011-06-09 20:46:06 -0700 | [diff] [blame] | 17 | // 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 Petkov | f7897bc | 2011-06-08 17:13:36 -0700 | [diff] [blame] | 23 | // 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 Petkov | 92c4390 | 2011-06-09 20:46:06 -0700 | [diff] [blame] | 32 | // g_spawn_close_pid |
| 33 | virtual void SpawnClosePID(GPid pid) = 0; |
Darin Petkov | f7897bc | 2011-06-08 17:13:36 -0700 | [diff] [blame] | 34 | }; |
| 35 | |
| 36 | } // namespace shill |
| 37 | |
| 38 | #endif // SHILL_GLIB_INTERFACE_H_ |