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/connection_unittest.cc b/connection_unittest.cc
index ec9807a..16e0f78 100644
--- a/connection_unittest.cc
+++ b/connection_unittest.cc
@@ -117,6 +117,18 @@
ipconfig_->properties().dns_servers,
ipconfig_->properties().domain_search));
+ scoped_refptr<MockDevice> device(new StrictMock<MockDevice>(
+ &control_,
+ reinterpret_cast<EventDispatcher *>(NULL),
+ reinterpret_cast<Metrics *>(NULL),
+ reinterpret_cast<Manager *>(NULL),
+ kTestDeviceName0,
+ string(),
+ kTestDeviceInterfaceIndex0));
+ EXPECT_CALL(*device_info_, GetDevice(kTestDeviceInterfaceIndex0))
+ .WillOnce(Return(device));
+ EXPECT_CALL(*device.get(), RequestPortalDetection())
+ .WillOnce(Return(true));
connection_->SetIsDefault(true);
EXPECT_TRUE(connection_->is_default());
@@ -133,6 +145,18 @@
Connection::kDefaultMetric));
vector<string> empty_list;
EXPECT_CALL(resolver_, SetDNSFromLists(empty_list, empty_list));
+ scoped_refptr<MockDevice> device(new StrictMock<MockDevice>(
+ &control_,
+ reinterpret_cast<EventDispatcher *>(NULL),
+ reinterpret_cast<Metrics *>(NULL),
+ reinterpret_cast<Manager *>(NULL),
+ kTestDeviceName0,
+ string(),
+ kTestDeviceInterfaceIndex0));
+ EXPECT_CALL(*device_info_, GetDevice(kTestDeviceInterfaceIndex0))
+ .WillOnce(Return(device));
+ EXPECT_CALL(*device.get(), RequestPortalDetection())
+ .WillOnce(Return(true));
connection_->SetIsDefault(true);
EXPECT_CALL(rtnl_handler_,