shill: vpn: Implement a ProcessKiller singleton.
This class may be used to terminate and reap child processes
asynchronously and robustly. Also:
- Use ProcessKiller to kill spawned "openvpn" and "l2tpipsec_vpn"
processes.
- Delete the associated OpenVPN tunnel interfaces cleanly after the
openvpn process dies.
- Fix a somewhat harmless bug where shill was sending SIGTERM to
already dead VPN processes from child watch callbacks.
BUG=chromium-os:31535,chromium-os:31571
TEST=unit tests, tested on device
Change-Id: If15f08e76c51dac33a434551ef4ba11ca66d0401
Reviewed-on: https://gerrit.chromium.org/gerrit/24610
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Darin Petkov <petkov@chromium.org>
diff --git a/mock_process_killer.h b/mock_process_killer.h
new file mode 100644
index 0000000..42b4bab
--- /dev/null
+++ b/mock_process_killer.h
@@ -0,0 +1,27 @@
+// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SHILL_MOCK_PROCESS_KILLER_H_
+#define SHILL_MOCK_PROCESS_KILLER_H_
+
+#include <gmock/gmock.h>
+
+#include "shill/process_killer.h"
+
+namespace shill {
+
+class MockProcessKiller : public ProcessKiller {
+ public:
+ MockProcessKiller();
+ virtual ~MockProcessKiller();
+
+ MOCK_METHOD2(Kill, void(int pid, const base::Closure &callback));
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(MockProcessKiller);
+};
+
+} // namespace shill
+
+#endif // SHILL_MOCK_PROCESS_KILLER_H_