shill: cellular: Use ConnectionHealthChecker for out-of-credit detection
Added code to trigger active connection monitoring using
ConnectionHealthChecker to detect out-of-credit scenarios, when:
1. TrafficMonitor detects congestion and thus a possible out-of-credit
situation;
2. Portal detection fails after Cellular connects.
BUG=chromium:225912,225915
TEST=1. Build and run unit tests.
2. While using a link device, run it out of credit. An
out-of-credit dialog should pop up and the service should
disconnect,
3. While on a link device with an out-of-credit SIM, try to connect
to Cellular. If it successfully connects and the connection
does not drop, an out-of-credit dialog should pop up and the
service should disconnect.
Change-Id: If70069c3630757b74099a4cefdfe6c67d8d308de
Reviewed-on: https://gerrit.chromium.org/gerrit/47717
Reviewed-by: Thieu Le <thieule@chromium.org>
Commit-Queue: Arman Uguray <armansito@chromium.org>
Tested-by: Arman Uguray <armansito@chromium.org>
diff --git a/connection_health_checker.h b/connection_health_checker.h
index 8aac9dc..f788878 100644
--- a/connection_health_checker.h
+++ b/connection_health_checker.h
@@ -63,11 +63,11 @@
// A new ConnectionHealthChecker is created with a default URL to attempt the
// TCP connection with. Add a URL to try.
- void AddRemoteURL(const std::string &url_string);
+ virtual void AddRemoteURL(const std::string &url_string);
// Name resolution can fail in conditions -(1)- and -(2)-. Add an IP address
// to attempt the TCP connection with.
- void AddRemoteIP(IPAddress ip);
+ virtual void AddRemoteIP(IPAddress ip);
// Start a connection health check. The health check involves one or more
// attempts at establishing and using a TCP connection. |result_callback_| is
@@ -87,6 +87,9 @@
// Accessors.
const IPAddressQueue &remote_ips() { return remote_ips_; }
void set_run_data_test(bool val) { run_data_test_ = val; }
+ virtual bool health_check_in_progress() const {
+ return health_check_in_progress_;
+ }
private:
friend class ConnectionHealthCheckerTest;