| 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 6098d80e8a4294da5aef8756163adcd688db26d8..baf2dfd828008942965e355c95fa4ae8ca07fba7 100644
|
| --- a/chrome/browser/captive_portal/captive_portal_service.cc
|
| +++ b/chrome/browser/captive_portal/captive_portal_service.cc
|
| @@ -10,6 +10,7 @@
|
| #include "base/message_loop/message_loop.h"
|
| #include "base/metrics/histogram.h"
|
| #include "base/prefs/pref_service.h"
|
| +#include "base/time/tick_clock.h"
|
| #include "chrome/browser/chrome_notification_types.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/common/pref_names.h"
|
| @@ -138,22 +139,20 @@ bool ShouldDeferToNativeCaptivePortalDetection() {
|
| CaptivePortalService::TestingState CaptivePortalService::testing_state_ =
|
| NOT_TESTING;
|
|
|
| -class CaptivePortalService::RecheckBackoffEntry : public net::BackoffEntry {
|
| +class CaptivePortalService::RecheckTickClock : public base::TickClock {
|
| public:
|
| - explicit RecheckBackoffEntry(CaptivePortalService* captive_portal_service)
|
| - : net::BackoffEntry(
|
| - &captive_portal_service->recheck_policy().backoff_policy),
|
| - captive_portal_service_(captive_portal_service) {
|
| + explicit RecheckTickClock(CaptivePortalService* captive_portal_service)
|
| + : captive_portal_service_(captive_portal_service) {
|
| }
|
|
|
| - private:
|
| - base::TimeTicks ImplGetTimeNow() const override {
|
| - return captive_portal_service_->GetCurrentTimeTicks();
|
| + base::TimeTicks NowTicks() override {
|
| + return captive_portal_service_->NowTicks();
|
| }
|
|
|
| + private:
|
| CaptivePortalService* captive_portal_service_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(RecheckBackoffEntry);
|
| + DISALLOW_COPY_AND_ASSIGN(RecheckTickClock);
|
| };
|
|
|
| CaptivePortalService::RecheckPolicy::RecheckPolicy()
|
| @@ -260,7 +259,7 @@ void CaptivePortalService::OnPortalDetectionCompleted(
|
|
|
| CaptivePortalResult result = results.result;
|
| const base::TimeDelta& retry_after_delta = results.retry_after_delta;
|
| - base::TimeTicks now = GetCurrentTimeTicks();
|
| + base::TimeTicks now = NowTicks();
|
|
|
| // Record histograms.
|
| UMA_HISTOGRAM_ENUMERATION("CaptivePortal.DetectResult",
|
| @@ -316,7 +315,7 @@ void CaptivePortalService::Shutdown() {
|
| RecordRepeatHistograms(
|
| last_detection_result_,
|
| num_checks_with_same_result_,
|
| - GetCurrentTimeTicks() - first_check_time_with_same_result_);
|
| + NowTicks() - first_check_time_with_same_result_);
|
| }
|
| }
|
|
|
| @@ -348,7 +347,9 @@ void CaptivePortalService::ResetBackoffEntry(CaptivePortalResult result) {
|
| recheck_policy_.initial_backoff_no_portal_ms;
|
| }
|
|
|
| - backoff_entry_.reset(new RecheckBackoffEntry(this));
|
| + backoff_entry_.reset(new net::BackoffEntry(
|
| + &recheck_policy().backoff_policy,
|
| + this));
|
| }
|
|
|
| void CaptivePortalService::UpdateEnabledState() {
|
| @@ -386,7 +387,7 @@ void CaptivePortalService::UpdateEnabledState() {
|
| }
|
| }
|
|
|
| -base::TimeTicks CaptivePortalService::GetCurrentTimeTicks() const {
|
| +base::TimeTicks CaptivePortalService::NowTicks() {
|
| if (time_ticks_for_testing_.is_null())
|
| return base::TimeTicks::Now();
|
| else
|
|
|