Commit cfb39f69 authored by meacer@chromium.org's avatar meacer@chromium.org

Add logging for distinguishing between captive portals with HTTP and HTTPS login pages

BUG=349737

Review URL: https://codereview.chromium.org/211983002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260237 0039d316-1c4b-4281-b951-d872f2087c98
parent e0d79f06
......@@ -103,6 +103,7 @@ void CaptivePortalDetector::GetCaptivePortalResultFromResponse(
results->result = RESULT_NO_RESPONSE;
results->response_code = url_fetcher->GetResponseCode();
results->retry_after_delta = base::TimeDelta();
results->landing_url = url_fetcher->GetURL();
// If there's a network error of some sort when fetching a file via HTTP,
// there may be a networking problem, rather than a captive portal.
......
......@@ -44,6 +44,7 @@ class CaptivePortalDetector : public net::URLFetcherDelegate,
Result result;
int response_code;
base::TimeDelta retry_after_delta;
GURL landing_url;
};
typedef base::Callback<void(const Results& results)> DetectionCallback;
......
......@@ -27,6 +27,22 @@ namespace captive_portal {
namespace {
// Make sure this enum is in sync with CaptivePortalDetectionResult enum
// in histograms.xml. This enum is append-only, don't modify existing values.
enum CaptivePortalDetectionResult {
// There's a confirmed connection to the Internet.
DETECTION_RESULT_INTERNET_CONNECTED,
// Received a network or HTTP error, or a non-HTTP response.
DETECTION_RESULT_NO_RESPONSE,
// Encountered a captive portal with a non-HTTPS landing URL.
DETECTION_RESULT_BEHIND_CAPTIVE_PORTAL,
// Received a network or HTTP error with an HTTPS landing URL.
DETECTION_RESULT_NO_RESPONSE_HTTPS_LANDING_URL,
// Encountered a captive portal with an HTTPS landing URL.
DETECTION_RESULT_BEHIND_CAPTIVE_PORTAL_HTTPS_LANDING_URL,
DETECTION_RESULT_COUNT
};
// Records histograms relating to how often captive portal detection attempts
// ended with |result| in a row, and for how long |result| was the last result
// of a detection attempt. Recorded both on quit and on a new Result.
......@@ -69,6 +85,26 @@ void RecordRepeatHistograms(Result result,
result_duration_histogram->AddTime(result_duration);
}
int GetHistogramEntryForDetectionResult(
const CaptivePortalDetector::Results& results) {
bool is_https = results.landing_url.SchemeIs("https");
switch (results.result) {
case RESULT_INTERNET_CONNECTED:
return DETECTION_RESULT_INTERNET_CONNECTED;
case RESULT_NO_RESPONSE:
return is_https ?
DETECTION_RESULT_NO_RESPONSE_HTTPS_LANDING_URL :
DETECTION_RESULT_NO_RESPONSE;
case RESULT_BEHIND_CAPTIVE_PORTAL:
return is_https ?
DETECTION_RESULT_BEHIND_CAPTIVE_PORTAL_HTTPS_LANDING_URL :
DETECTION_RESULT_BEHIND_CAPTIVE_PORTAL;
default:
NOTREACHED();
return -1;
}
}
bool ShouldDeferToNativeCaptivePortalDetection() {
// On Windows 8, defer to the native captive portal detection. OSX Lion and
// later also have captive portal detection, but experimentally, this code
......@@ -210,8 +246,8 @@ void CaptivePortalService::OnPortalDetectionCompleted(
// Record histograms.
UMA_HISTOGRAM_ENUMERATION("CaptivePortal.DetectResult",
result,
RESULT_COUNT);
GetHistogramEntryForDetectionResult(results),
DETECTION_RESULT_COUNT);
// If this isn't the first captive portal result, record stats.
if (!last_check_time_.is_null()) {
......
......@@ -1796,6 +1796,11 @@ other types of suffix sets.
</summary>
</histogram>
<histogram name="CaptivePortal.DetectResult" enum="CaptivePortalDetectResult">
<owner>meacer@chromium.org</owner>
<summary>Records the result of a captive portal probe.</summary>
</histogram>
<histogram name="CaptivePortal.Notification.Status"
enum="CaptivePortalNotificationStatus">
<owner>ygorshenin@chromium.org</owner>
......@@ -30043,6 +30048,14 @@ other types of suffix sets.
<int value="3" label="webgl"/>
</enum>
<enum name="CaptivePortalDetectResult" type="int">
<int value="0" label="INTERNET_CONNECTED"/>
<int value="1" label="NO_RESPONSE"/>
<int value="2" label="BEHIND_CAPTIVE_PORTAL"/>
<int value="3" label="NO_RESPONSE_HTTPS_LANDING_URL"/>
<int value="4" label="BEHIND_CAPTIVE_PORTAL_HTTPS_LANDING_URL"/>
</enum>
<enum name="CaptivePortalNotificationStatus" type="int">
<int value="0" label="UNKNOWN"/>
<int value="1" label="OFFLINE"/>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment