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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
7 #include "chrome/browser/sync/profile_sync_service.h" | 7 #include "chrome/browser/sync/profile_sync_service.h" |
8 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" | 8 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" |
9 #include "chrome/browser/sync/test/integration/retry_verifier.h" | 9 #include "chrome/browser/sync/test/integration/retry_verifier.h" |
10 #include "chrome/browser/sync/test/integration/single_client_status_change_check
er.h" | 10 #include "chrome/browser/sync/test/integration/single_client_status_change_check
er.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 explicit ExponentialBackoffChecker(ProfileSyncService* pss) | 36 explicit ExponentialBackoffChecker(ProfileSyncService* pss) |
37 : SingleClientStatusChangeChecker(pss) { | 37 : SingleClientStatusChangeChecker(pss) { |
38 const SyncSessionSnapshot& snap = service()->GetLastSessionSnapshot(); | 38 const SyncSessionSnapshot& snap = service()->GetLastSessionSnapshot(); |
39 retry_verifier_.Initialize(snap); | 39 retry_verifier_.Initialize(snap); |
40 } | 40 } |
41 | 41 |
42 virtual ~ExponentialBackoffChecker() {} | 42 virtual ~ExponentialBackoffChecker() {} |
43 | 43 |
44 // Checks if backoff is complete. Called repeatedly each time PSS notifies | 44 // Checks if backoff is complete. Called repeatedly each time PSS notifies |
45 // observers of a state change. | 45 // observers of a state change. |
46 virtual bool IsExitConditionSatisfied() OVERRIDE { | 46 virtual bool IsExitConditionSatisfied() override { |
47 const SyncSessionSnapshot& snap = service()->GetLastSessionSnapshot(); | 47 const SyncSessionSnapshot& snap = service()->GetLastSessionSnapshot(); |
48 retry_verifier_.VerifyRetryInterval(snap); | 48 retry_verifier_.VerifyRetryInterval(snap); |
49 return (retry_verifier_.done() && retry_verifier_.Succeeded()); | 49 return (retry_verifier_.done() && retry_verifier_.Succeeded()); |
50 } | 50 } |
51 | 51 |
52 virtual std::string GetDebugMessage() const OVERRIDE { | 52 virtual std::string GetDebugMessage() const override { |
53 return base::StringPrintf("Verifying backoff intervals (%d/%d)", | 53 return base::StringPrintf("Verifying backoff intervals (%d/%d)", |
54 retry_verifier_.retry_count(), | 54 retry_verifier_.retry_count(), |
55 RetryVerifier::kMaxRetry); | 55 RetryVerifier::kMaxRetry); |
56 } | 56 } |
57 | 57 |
58 private: | 58 private: |
59 // Keeps track of the number of attempts at exponential backoff and its | 59 // Keeps track of the number of attempts at exponential backoff and its |
60 // related bookkeeping information for verification. | 60 // related bookkeeping information for verification. |
61 RetryVerifier retry_verifier_; | 61 RetryVerifier retry_verifier_; |
62 | 62 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 // Verify that the client goes into exponential backoff while it is unable to | 107 // Verify that the client goes into exponential backoff while it is unable to |
108 // reach the sync server. | 108 // reach the sync server. |
109 ExponentialBackoffChecker exponential_backoff_checker( | 109 ExponentialBackoffChecker exponential_backoff_checker( |
110 GetSyncService((0))); | 110 GetSyncService((0))); |
111 exponential_backoff_checker.Wait(); | 111 exponential_backoff_checker.Wait(); |
112 ASSERT_FALSE(exponential_backoff_checker.TimedOut()); | 112 ASSERT_FALSE(exponential_backoff_checker.TimedOut()); |
113 } | 113 } |
114 | 114 |
115 } // namespace | 115 } // namespace |
OLD | NEW |