shill: Start a mockable GLib interface.
Use the interface to test DHCPConfig::Start.
BUG=chromium-os:16319,chromium-os:16013
TEST=unit test, tested on device
Change-Id: Ice6c65b0cc2ac2dd738cb6aacb426703cce48a3f
Reviewed-on: http://gerrit.chromium.org/gerrit/2356
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Chris Masone <cmasone@chromium.org>
diff --git a/dhcp_provider.cc b/dhcp_provider.cc
index e082d5e..c506a77 100644
--- a/dhcp_provider.cc
+++ b/dhcp_provider.cc
@@ -10,7 +10,7 @@
namespace shill {
-DHCPProvider::DHCPProvider() {
+DHCPProvider::DHCPProvider() : glib_(NULL) {
VLOG(2) << __func__;
}
@@ -22,14 +22,16 @@
return Singleton<DHCPProvider>::get();
}
-void DHCPProvider::Init(DBus::Connection *connection) {
+void DHCPProvider::Init(DBus::Connection *connection,
+ GLibInterface *glib) {
VLOG(2) << __func__;
listener_.reset(new DHCPCDListener(this, connection));
+ glib_ = glib;
}
DHCPConfigRefPtr DHCPProvider::CreateConfig(DeviceConstRefPtr device) {
VLOG(2) << __func__;
- return DHCPConfigRefPtr(new DHCPConfig(this, device));
+ return DHCPConfigRefPtr(new DHCPConfig(this, device, glib_));
}
DHCPConfigRefPtr DHCPProvider::GetConfig(unsigned int pid) {