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/macros.h" | 6 #include "base/macros.h" |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.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 15 matching lines...) Expand all Loading... |
26 ~SyncExponentialBackoffTest() override {} | 26 ~SyncExponentialBackoffTest() override {} |
27 | 27 |
28 private: | 28 private: |
29 DISALLOW_COPY_AND_ASSIGN(SyncExponentialBackoffTest); | 29 DISALLOW_COPY_AND_ASSIGN(SyncExponentialBackoffTest); |
30 }; | 30 }; |
31 | 31 |
32 // Helper class that checks if a sync client has successfully gone through | 32 // Helper class that checks if a sync client has successfully gone through |
33 // exponential backoff after it encounters an error. | 33 // exponential backoff after it encounters an error. |
34 class ExponentialBackoffChecker : public SingleClientStatusChangeChecker { | 34 class ExponentialBackoffChecker : public SingleClientStatusChangeChecker { |
35 public: | 35 public: |
36 explicit ExponentialBackoffChecker(ProfileSyncService* pss) | 36 explicit ExponentialBackoffChecker(browser_sync::ProfileSyncService* pss) |
37 : SingleClientStatusChangeChecker(pss) { | 37 : SingleClientStatusChangeChecker(pss) { |
38 const SyncCycleSnapshot& snap = service()->GetLastCycleSnapshot(); | 38 const SyncCycleSnapshot& snap = service()->GetLastCycleSnapshot(); |
39 retry_verifier_.Initialize(snap); | 39 retry_verifier_.Initialize(snap); |
40 } | 40 } |
41 | 41 |
42 ~ExponentialBackoffChecker() override {} | 42 ~ExponentialBackoffChecker() override {} |
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 bool IsExitConditionSatisfied() override { | 46 bool IsExitConditionSatisfied() override { |
47 const SyncCycleSnapshot& snap = service()->GetLastCycleSnapshot(); | 47 const SyncCycleSnapshot& snap = service()->GetLastCycleSnapshot(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 // Verify that the client goes into exponential backoff while it is unable to | 117 // Verify that the client goes into exponential backoff while it is unable to |
118 // reach the sync server. | 118 // reach the sync server. |
119 ExponentialBackoffChecker exponential_backoff_checker( | 119 ExponentialBackoffChecker exponential_backoff_checker( |
120 GetSyncService((0))); | 120 GetSyncService((0))); |
121 exponential_backoff_checker.Wait(); | 121 exponential_backoff_checker.Wait(); |
122 ASSERT_FALSE(exponential_backoff_checker.TimedOut()); | 122 ASSERT_FALSE(exponential_backoff_checker.TimedOut()); |
123 } | 123 } |
124 | 124 |
125 } // namespace | 125 } // namespace |
OLD | NEW |