shill: create external_task abstraction

This moves code out of L2TPIPSecDriver into a new ExternalTask
class, and updates the L2TPIPSecDriver code appropriately.

While there:
- fix a couple bug in L2TPIPSecDriverTest::ExpectInFlags.
  (The function was returning early, and not checking the value
  of the flag.)
- remove RpcTask::GetRpcInterfaceIdentifier, since the only
  place it was called from was a test.

BUG=chromium:209938
TEST=unit tests, manual

Manual test
-----------
- connect to CrOS_WPA2_Buffalo2_AG300H_2.4GHz
- /usr/local/lib/flimflam/test/connect-vpn l2tpipsec-psk \
    Cisco-ASA-173 172.22.22.173 \
    Cisco-ASA-173 chromeos_psk \
    CrOS_Password <password>
- check that ppp0 has an IP address
- egrep "l2tpipsec_vpn.+pppd: local" /var/log/net.log
  (should match)

Change-Id: I54aed25f14597d0324249aaddba2095d296ded7d
Reviewed-on: https://gerrit.chromium.org/gerrit/57193
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
diff --git a/mock_external_task.h b/mock_external_task.h
new file mode 100644
index 0000000..6469c83
--- /dev/null
+++ b/mock_external_task.h
@@ -0,0 +1,36 @@
+// Copyright (c) 2013 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_EXTERNAL_TASK_H_
+#define SHILL_MOCK_EXTERNAL_TASK_H_
+
+#include <gmock/gmock.h>
+
+#include "shill/external_task.h"
+
+namespace shill {
+
+class MockExternalTask : public ExternalTask {
+public:
+  MockExternalTask(ControlInterface *control,
+                   GLib *glib,
+                   const base::WeakPtr<RPCTaskDelegate> &task_delegate,
+                   const base::Callback<void(pid_t, int)> &death_callback);
+  virtual ~MockExternalTask();
+
+  MOCK_METHOD4(Start,
+               bool(const base::FilePath &file,
+                    const std::vector<std::string> &arguments,
+                    const std::map<std::string, std::string> &environment,
+                    Error *error));
+  MOCK_METHOD0(Stop, void());
+  MOCK_METHOD0(OnDelete, void());
+
+private:
+  DISALLOW_COPY_AND_ASSIGN(MockExternalTask);
+};
+
+}  // namespace shill
+
+#endif  // SHILL_MOCK_EXTERNAL_TASK_H_