Index: chrome/browser/chromeos/net/network_portal_detector_impl.h |
diff --git a/chrome/browser/chromeos/net/network_portal_detector_impl.h b/chrome/browser/chromeos/net/network_portal_detector_impl.h |
index 53125534e7bf6a9cdf35a33a65a7c716c5c8d632..7573c806d81144fdac89fefa1bf9c464a51f5738 100644 |
--- a/chrome/browser/chromeos/net/network_portal_detector_impl.h |
+++ b/chrome/browser/chromeos/net/network_portal_detector_impl.h |
@@ -82,7 +82,7 @@ class NetworkPortalDetectorImpl |
virtual void DefaultNetworkChanged(const NetworkState* network) OVERRIDE; |
// PortalDetectorStrategy::Delegate implementation: |
- virtual int AttemptCount() OVERRIDE; |
+ virtual uint64 NoResponseResultCount() OVERRIDE; |
virtual base::TimeTicks AttemptStartTime() OVERRIDE; |
virtual base::TimeTicks GetCurrentTimeTicks() OVERRIDE; |
@@ -126,12 +126,7 @@ class NetworkPortalDetectorImpl |
// Stops whole detection process. |
void StopDetection(); |
- // Internal predicate which describes set of states from which |
- // DetectCaptivePortal() can be called. |
- bool CanPerformAttempt() const; |
- |
// Initiates Captive Portal detection attempt after |delay|. |
- // You should check CanPerformAttempt() before calling this method. |
void ScheduleAttempt(const base::TimeDelta& delay); |
// Starts detection attempt. |
@@ -170,12 +165,16 @@ class NetworkPortalDetectorImpl |
return state_ == STATE_CHECKING_FOR_PORTAL; |
} |
- int attempt_count_for_testing() { |
- return attempt_count_; |
+ uint64 same_detection_result_count_for_testing() const { |
+ return same_detection_result_count_; |
+ } |
+ |
+ uint64 no_response_result_count_for_testing() const { |
antrim
2014/07/10 13:53:13
What is the reason for using uint64 instead of int
ygorshenin1
2014/07/11 11:46:12
Due to errors or something else int can overflow w
|
+ return no_response_result_count_; |
} |
- void set_attempt_count_for_testing(int attempt_count) { |
- attempt_count_ = attempt_count; |
+ void set_no_response_result_count_for_testing(uint64 count) { |
+ no_response_result_count_ = count; |
} |
// Returns delay before next portal check. Used by unit tests. |
@@ -192,6 +191,10 @@ class NetworkPortalDetectorImpl |
void RecordDetectionStats(const NetworkState* network, |
CaptivePortalStatus status); |
+ // Resets strategy and all counters used in computations of |
+ // timeouts. |
+ void ResetStrategyAndCounters(); |
+ |
// Sets current test time ticks. Used by unit tests. |
void set_time_ticks_for_testing(const base::TimeTicks& time_ticks) { |
time_ticks_for_testing_ = time_ticks; |
@@ -236,15 +239,21 @@ class NetworkPortalDetectorImpl |
// Start time of detection attempt. |
base::TimeTicks attempt_start_time_; |
- // Number of already performed detection attempts. |
- int attempt_count_; |
- |
// Delay before next portal detection. |
base::TimeDelta next_attempt_delay_; |
// Current detection strategy. |
scoped_ptr<PortalDetectorStrategy> strategy_; |
+ // Last received result from captive portal detector. |
+ CaptivePortalStatus last_detection_result_; |
+ |
+ // Number of detection attempts with same result in a row. |
+ uint64 same_detection_result_count_; |
+ |
+ // Number of detection attempts in a row with NO RESPONSE result. |
+ uint64 no_response_result_count_; |
+ |
// UI notification controller about captive portal state. |
NetworkPortalNotificationController notification_controller_; |