update_engine: Use libchromeos to launch subprocesses.

The Subprocess class handles the execution of suprocesses in the
update_engine such as the post-install script and bspatch operations.

This patch migrates this class from using glib functions to use
libchromeos classes with equivalent functionality.

Callsites and unittests were updated to match the new interface.

BUG=chromium:499886
TEST=Unittest still pass. Deployed on link and cros flash another image
using a delta payload.

Change-Id: Ia64d39734e220675113f393a6049e9a9b0fe8409
Reviewed-on: https://chromium-review.googlesource.com/288837
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
diff --git a/p2p_manager_unittest.cc b/p2p_manager_unittest.cc
index 8667578..ec93bc6 100644
--- a/p2p_manager_unittest.cc
+++ b/p2p_manager_unittest.cc
@@ -57,6 +57,7 @@
   // Derived from testing::Test.
   void SetUp() override {
     loop_.SetAsCurrent();
+    subprocess_.Init();
     test_conf_ = new FakeP2PManagerConfiguration();
 
     // Allocate and install a mock policy implementation in the fake Update
@@ -71,14 +72,11 @@
                                          TimeDelta::FromDays(5)));
   }
 
-  void TearDown() override {
-    EXPECT_EQ(0, chromeos::MessageLoopRunMaxIterations(&loop_, 1));
-  }
-
   // TODO(deymo): Replace this with a FakeMessageLoop. P2PManager uses glib to
   // interact with the p2p-client tool, so we need to run a GlibMessageLoop
   // here.
   chromeos::GlibMessageLoop loop_;
+  Subprocess subprocess_;
 
   // The P2PManager::Configuration instance used for testing.
   FakeP2PManagerConfiguration *test_conf_;