Add metric for broken DNS configuration.
Attempt a DNS test using Google's public DNS server if portal detection
failed due to DNS failure, and report the result of the DNS test
to UMA metric.
BUG=chromium:366301
TEST=unit tests, manual
Manual Test:
1. Connect a chrome device to an AP with no internet access,
then browse to "chrome://histograms" and verify there is a
histogram for "Network.Shill.DNSTestResult" with a hit for
value 1 (Failure).
2. Manually update the code to perform DNS test when portal detection
succeed. Connect a chrome device to "GoogleGuest", and verify
there is a hit for value 0 (Success) for the histogram
"Network.Shill.DNSTestResult".
Change-Id: I8cb22f7664fcfa7fd08d3d3dd24902f7896a4e3e
Reviewed-on: https://chromium-review.googlesource.com/199174
Reviewed-by: Peter Qiu <zqiu@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
diff --git a/metrics.h b/metrics.h
index 4306388..58ea4fd 100644
--- a/metrics.h
+++ b/metrics.h
@@ -285,6 +285,12 @@
kUserInitiatedConnectionResultMax
};
+ enum DNSTestResult {
+ kDNSTestResultSuccess = 0,
+ kDNSTestResultFailure,
+ kDNSTestResultMax
+ };
+
static const char kMetricDisconnectSuffix[];
static const int kMetricDisconnectMax;
static const int kMetricDisconnectMin;
@@ -485,6 +491,9 @@
// User-initiated wifi connection attempt result.
static const char kMetricWifiUserInitiatedConnectionResult[];
+ // DNS test result.
+ static const char kMetricFallbackDNSTestResult[];
+
explicit Metrics(EventDispatcher *dispatcher);
virtual ~Metrics();
@@ -671,6 +680,9 @@
// Notifies this object about user-initiated event.
virtual void NotifyUserInitiatedEvent(int event);
+ // Notifies this object about the result of the fallback DNS test.
+ virtual void NotifyFallbackDNSTestResult(int result);
+
// Sends linear histogram data to UMA.
virtual bool SendEnumToUMA(const std::string &name, int sample, int max);