shill: renew DHCP on resume

When the system resumes, we should renew our DHCP lease. This is
because the alarm that dhcpcd uses for DHCP renewals doesn't
advance to reflect time spent suspended.

We could modify dhcpcd to use alarms that do include time spent
suspended, but that's a bigger change than I'd really like to make.
(We'd need to use create_timerfd/set_timerfd, and modify the kernel
to allow a timerfd to be bound to CLOCK_BOOTTIME.)

Renew-on-resume is implemented by having Manager call an event handler
on each Device, as the system resumes. The Device is responsible for
poking its IPConfig object to actually renew the DHCP lease.

While there, I added a call from Manager to Devices for suspend events
as well.

BUG=chromium-os:33219
TEST=new autotests, manual (see below)

Manual testing:
- Connect WiFi to GoogleGuest.
- "echo > /var/log/messages"
- Suspend the device.
- Resume the device 60 seconds later.
- Check that /var/log/messages includes "dhcpcd[<pid>]: wlan0:
  rebinding lease", and that WiFi did not disconnect before that
  message showed up.
- NB: Testing on Ethernet did not work, because the link went down
  during suspend. (Thus, on resume, there was no ipconfig set, and
  Device could not renew.)

Change-Id: I76e29c68882415ebb34759aba98a40ecb5e1694b
Reviewed-on: https://gerrit.chromium.org/gerrit/29766
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: mukesh agrawal <quiche@chromium.org>
diff --git a/manager_unittest.cc b/manager_unittest.cc
index 4251432..06e8593 100644
--- a/manager_unittest.cc
+++ b/manager_unittest.cc
@@ -54,6 +54,7 @@
 using ::testing::ContainerEq;
 using ::testing::DoAll;
 using ::testing::InSequence;
+using ::testing::Mock;
 using ::testing::Ne;
 using ::testing::NiceMock;
 using ::testing::Return;
@@ -2140,15 +2141,20 @@
   SetPowerManager();
   EXPECT_CALL(*service, AutoConnect());
   manager()->RegisterService(service);
+  manager()->RegisterDevice(mock_devices_[0]);
   dispatcher()->DispatchPendingEvents();
 
+  EXPECT_CALL(*mock_devices_[0], OnAfterResume());
   OnPowerStateChanged(PowerManagerProxyDelegate::kOn);
   EXPECT_CALL(*service, AutoConnect());
   dispatcher()->DispatchPendingEvents();
+  Mock::VerifyAndClearExpectations(mock_devices_[0]);
 
+  EXPECT_CALL(*mock_devices_[0], OnBeforeSuspend());
   OnPowerStateChanged(PowerManagerProxyDelegate::kMem);
   EXPECT_CALL(*service, AutoConnect()).Times(0);
   dispatcher()->DispatchPendingEvents();
+  Mock::VerifyAndClearExpectations(mock_devices_[0]);
 }
 
 TEST_F(ManagerTest, RecheckPortal) {