shill: portal: Recheck portal state

Introduce a retry interval for automatically retrying portal
checks.  Also provide a Manager API method for immediately
re-checking portal status.

BUG=chromium-os:27335
TEST=New unit tests, tested on real machine, including setting
PortaCheckInterval over DBus, and using Jason's addition to
test-flimflam for 'recheck-portal'.
Change-Id: Idc7def18c6f863859e94f4d4e9f266ab2670679c
Reviewed-on: https://gerrit.chromium.org/gerrit/17367
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/device.h b/device.h
index 8036cd1..130eabe 100644
--- a/device.h
+++ b/device.h
@@ -97,6 +97,10 @@
   // is not connected.
   bool IsConnected() const;
 
+  // Requests that portal detection be done, if this device has the default
+  // connection.  Returns true if portal detection was started.
+  virtual bool RequestPortalDetection();
+
   std::string GetRpcIdentifier();
   std::string GetStorageIdentifier();
 
@@ -139,6 +143,7 @@
   FRIEND_TEST(DeviceTest, GetProperties);
   FRIEND_TEST(DeviceTest, Save);
   FRIEND_TEST(DeviceTest, SelectedService);
+  FRIEND_TEST(DeviceTest, SetServiceConnectedState);
   FRIEND_TEST(DeviceTest, Stop);
   FRIEND_TEST(ManagerTest, DeviceRegistrationAndStart);
   FRIEND_TEST(ManagerTest, ConnectedTechnologies);
@@ -203,6 +208,7 @@
 
  private:
   friend class DeviceAdaptorInterface;
+  friend class DevicePortalDetectionTest;
   friend class DeviceTest;
   friend class CellularTest;
   friend class WiFiMainTest;