OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/sync/test/integration/retry_verifier.h" | 5 #include "chrome/browser/sync/test/integration/retry_verifier.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "sync/internal_api/public/engine/polling_constants.h" | 12 #include "components/sync/engine/polling_constants.h" |
13 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" | 13 #include "components/sync/sessions/sync_session_snapshot.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 // Given the current delay calculate the minimum and maximum wait times for | 16 // Given the current delay calculate the minimum and maximum wait times for |
17 // the next retry. | 17 // the next retry. |
18 DelayInfo CalculateDelay(int64_t current_delay) { | 18 DelayInfo CalculateDelay(int64_t current_delay) { |
19 int64_t backoff_s = | 19 int64_t backoff_s = |
20 std::max(static_cast<int64_t>(1), | 20 std::max(static_cast<int64_t>(1), |
21 current_delay * syncer::kBackoffRandomizationFactor); | 21 current_delay * syncer::kBackoffRandomizationFactor); |
22 | 22 |
23 DelayInfo delay_info; | 23 DelayInfo delay_info; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 if (snap.sync_start_time() != last_sync_time_) { | 107 if (snap.sync_start_time() != last_sync_time_) { |
108 base::TimeDelta delta = snap.sync_start_time() - last_sync_time_; | 108 base::TimeDelta delta = snap.sync_start_time() - last_sync_time_; |
109 success_ = IsRetryOnTime(delay_table_,retry_count_ -1, delta); | 109 success_ = IsRetryOnTime(delay_table_,retry_count_ -1, delta); |
110 last_sync_time_ = snap.sync_start_time(); | 110 last_sync_time_ = snap.sync_start_time(); |
111 ++retry_count_; | 111 ++retry_count_; |
112 done_ = (retry_count_ >= kMaxRetry); | 112 done_ = (retry_count_ >= kMaxRetry); |
113 return; | 113 return; |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
OLD | NEW |