Commit 7ec270ce authored by Mike Dougherty's avatar Mike Dougherty Committed by Commit Bot

Expose SSL interstitial delay for captive portal detection.

Exposing kSSLInterstitialDelayInSeconds allows tests to use it directly
rather than duplicating the value of the constant.

Bug: 790934
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: If2cabdf773ce414dc966e0396847660d835c1d72
Reviewed-on: https://chromium-review.googlesource.com/806643
Commit-Queue: Mike Dougherty <michaeldo@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521712}
parent 6ec61cec
...@@ -21,6 +21,12 @@ namespace web { ...@@ -21,6 +21,12 @@ namespace web {
class WebState; class WebState;
} // namespace web } // namespace web
// Default delay in seconds before displaying the SSL interstitial.
// - If a "captive portal detected" result arrives during this time,
// a captive portal interstitial is displayed.
// - Otherwise, an SSL interstitial is displayed.
extern const int64_t kSSLInterstitialDelayInSeconds;
// This class is responsible for deciding what type of interstitial to show for // This class is responsible for deciding what type of interstitial to show for
// an SSL validation error. // an SSL validation error.
class IOSSSLErrorHandler : public web::WebStateUserData<IOSSSLErrorHandler> { class IOSSSLErrorHandler : public web::WebStateUserData<IOSSSLErrorHandler> {
......
...@@ -30,11 +30,7 @@ DEFINE_WEB_STATE_USER_DATA_KEY(IOSSSLErrorHandler); ...@@ -30,11 +30,7 @@ DEFINE_WEB_STATE_USER_DATA_KEY(IOSSSLErrorHandler);
const char kSessionDetectionResultHistogram[] = const char kSessionDetectionResultHistogram[] =
"CaptivePortal.Session.DetectionResult"; "CaptivePortal.Session.DetectionResult";
// Default delay in milliseconds before displaying the SSL interstitial. const int64_t kSSLInterstitialDelayInSeconds = 3;
// - If a "captive portal detected" result arrives during this time,
// a captive portal interstitial is displayed.
// - Otherwise, an SSL interstitial is displayed.
const int64_t kInterstitialDelayInMilliseconds = 3000;
using captive_portal::CaptivePortalDetector; using captive_portal::CaptivePortalDetector;
...@@ -102,10 +98,9 @@ void IOSSSLErrorHandler::StartHandlingError() { ...@@ -102,10 +98,9 @@ void IOSSSLErrorHandler::StartHandlingError() {
// Default to presenting the SSL interstitial if Captive Portal detection // Default to presenting the SSL interstitial if Captive Portal detection
// takes too long. // takes too long.
timer_.Start( timer_.Start(FROM_HERE,
FROM_HERE, base::TimeDelta::FromSeconds(kSSLInterstitialDelayInSeconds),
base::TimeDelta::FromMilliseconds(kInterstitialDelayInMilliseconds), this, this, &IOSSSLErrorHandler::ShowSSLInterstitial);
&IOSSSLErrorHandler::ShowSSLInterstitial);
} }
void IOSSSLErrorHandler::HandleCaptivePortalDetectionResult( void IOSSSLErrorHandler::HandleCaptivePortalDetectionResult(
......
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