| Index: chrome/browser/captive_portal/captive_portal_service.cc
|
| diff --git a/chrome/browser/captive_portal/captive_portal_service.cc b/chrome/browser/captive_portal/captive_portal_service.cc
|
| index 93c37a8c1b81f69c8f9c174e934e7a1276f8a3bd..fa83508caad112cb6a22ade1cc9a915fc7dbd67e 100644
|
| --- a/chrome/browser/captive_portal/captive_portal_service.cc
|
| +++ b/chrome/browser/captive_portal/captive_portal_service.cc
|
| @@ -194,7 +194,8 @@ CaptivePortalService::CaptivePortalService(Profile* profile)
|
| enabled_(false),
|
| last_detection_result_(captive_portal::RESULT_INTERNET_CONNECTED),
|
| num_checks_with_same_result_(0),
|
| - test_url_(captive_portal::CaptivePortalDetector::kDefaultURL) {
|
| + test_url_(captive_portal::CaptivePortalDetector::kDefaultURL),
|
| + portal_detection_enabled_(true) {
|
| // The order matters here:
|
| // |resolve_errors_with_web_service_| must be initialized and |backoff_entry_|
|
| // created before the call to UpdateEnabledState.
|
| @@ -211,9 +212,17 @@ CaptivePortalService::CaptivePortalService(Profile* profile)
|
| CaptivePortalService::~CaptivePortalService() {
|
| }
|
|
|
| +void CaptivePortalService::SetPortalDetectionEnabledForTest(bool enabled) {
|
| + portal_detection_enabled_ = enabled;
|
| +}
|
| +
|
| void CaptivePortalService::DetectCaptivePortal() {
|
| DCHECK(CalledOnValidThread());
|
|
|
| + // Detection should be disabled only in tests.
|
| + if (!portal_detection_enabled_)
|
| + return;
|
| +
|
| // If a request is pending or running, do nothing.
|
| if (state_ == STATE_CHECKING_FOR_PORTAL || state_ == STATE_TIMER_RUNNING)
|
| return;
|
|
|