shill: Implement Service.Remove & delete DHCP leases

Implement the Service.Remove dbus API and modify the unload sequence to
remove the DHCP lease file. Add unit tests to DHCPProvider & WiFiService to
check lease file deletion. Currently only WiFi does the DHCP lease delete
from DBus - WiMax/Cell/VPN do their own things for IP configuration and
Ethernet can't be removed as per the API spec.

Also make sure FilePath is qualified as base::FilePath throughout the project.

BUG=chromium-os:32756
TEST=added unittests to test the call path on Unload() to delete the lease file

Change-Id: Ic6eee17b9d81cd0be8d09c683d85d6a4d19278c9
Reviewed-on: https://gerrit.chromium.org/gerrit/44339
Tested-by: Albert Chaulk <achaulk@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
diff --git a/dhcp_provider.cc b/dhcp_provider.cc
index f423b6d..10ddd64 100644
--- a/dhcp_provider.cc
+++ b/dhcp_provider.cc
@@ -4,12 +4,16 @@
 
 #include "shill/dhcp_provider.h"
 
+#include <base/file_util.h>
+#include <base/stringprintf.h>
+
 #include "shill/control_interface.h"
 #include "shill/dhcp_config.h"
 #include "shill/dhcpcd_proxy.h"
 #include "shill/logging.h"
 #include "shill/proxy_factory.h"
 
+using base::FilePath;
 using std::string;
 
 namespace shill {
@@ -18,8 +22,12 @@
 base::LazyInstance<DHCPProvider> g_dhcp_provider = LAZY_INSTANCE_INITIALIZER;
 }  // namespace
 
+const char DHCPProvider::kDHCPCDPathFormatLease[] =
+    "var/lib/dhcpcd/dhcpcd-%s.lease";
+
 DHCPProvider::DHCPProvider()
     : proxy_factory_(ProxyFactory::GetInstance()),
+      root_("/"),
       control_interface_(NULL),
       dispatcher_(NULL),
       glib_(NULL) {
@@ -78,4 +86,11 @@
   configs_.erase(pid);
 }
 
+void DHCPProvider::DestroyLease(const string &name) {
+  SLOG(DHCP, 2) << __func__ << " name: " << name;
+  file_util::Delete(root_.Append(
+      base::StringPrintf(kDHCPCDPathFormatLease,
+                         name.c_str())), false);
+}
+
 }  // namespace shill