| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Utils to simulate various outcomes of a sync session. | 5 // Utils to simulate various outcomes of a sync session. |
| 6 #ifndef SYNC_SESSIONS_TEST_UTIL_H_ | 6 #ifndef COMPONENTS_SYNC_SESSIONS_IMPL_TEST_UTIL_H_ |
| 7 #define SYNC_SESSIONS_TEST_UTIL_H_ | 7 #define COMPONENTS_SYNC_SESSIONS_IMPL_TEST_UTIL_H_ |
| 8 | 8 |
| 9 #include "sync/engine/syncer.h" | 9 #include "components/sync/engine_impl/syncer.h" |
| 10 #include "sync/sessions/sync_session.h" | 10 #include "components/sync/sessions_impl/sync_session.h" |
| 11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 namespace syncer { | 14 namespace syncer { |
| 15 namespace sessions { | 15 namespace sessions { |
| 16 namespace test_util { | 16 namespace test_util { |
| 17 | 17 |
| 18 // Configure sync cycle successes and failures. | 18 // Configure sync cycle successes and failures. |
| 19 void SimulateGetEncryptionKeyFailed( | 19 void SimulateGetEncryptionKeyFailed( |
| 20 ModelTypeSet requested_types, | 20 ModelTypeSet requested_types, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 50 // Poll successes and failures. | 50 // Poll successes and failures. |
| 51 void SimulatePollSuccess(ModelTypeSet requested_types, | 51 void SimulatePollSuccess(ModelTypeSet requested_types, |
| 52 sessions::SyncSession* session); | 52 sessions::SyncSession* session); |
| 53 void SimulatePollFailed(ModelTypeSet requested_types, | 53 void SimulatePollFailed(ModelTypeSet requested_types, |
| 54 sessions::SyncSession* session); | 54 sessions::SyncSession* session); |
| 55 | 55 |
| 56 void SimulateGuRetryDelayCommandImpl(sessions::SyncSession* session, | 56 void SimulateGuRetryDelayCommandImpl(sessions::SyncSession* session, |
| 57 base::TimeDelta delay); | 57 base::TimeDelta delay); |
| 58 | 58 |
| 59 void SimulateThrottledImpl(sessions::SyncSession* session, | 59 void SimulateThrottledImpl(sessions::SyncSession* session, |
| 60 const base::TimeDelta& delta); | 60 const base::TimeDelta& delta); |
| 61 | 61 |
| 62 void SimulateTypesThrottledImpl( | 62 void SimulateTypesThrottledImpl(sessions::SyncSession* session, |
| 63 sessions::SyncSession* session, | 63 ModelTypeSet types, |
| 64 ModelTypeSet types, | 64 const base::TimeDelta& delta); |
| 65 const base::TimeDelta& delta); | |
| 66 | 65 |
| 67 // Works with poll cycles. | 66 // Works with poll cycles. |
| 68 void SimulatePollIntervalUpdateImpl( | 67 void SimulatePollIntervalUpdateImpl(ModelTypeSet requested_types, |
| 69 ModelTypeSet requested_types, | 68 sessions::SyncSession* session, |
| 70 sessions::SyncSession* session, | 69 const base::TimeDelta& new_poll); |
| 71 const base::TimeDelta& new_poll); | |
| 72 | 70 |
| 73 // Works with normal cycles. | 71 // Works with normal cycles. |
| 74 void SimulateSessionsCommitDelayUpdateImpl( | 72 void SimulateSessionsCommitDelayUpdateImpl( |
| 75 ModelTypeSet requested_types, | 73 ModelTypeSet requested_types, |
| 76 sessions::NudgeTracker* nudge_tracker, | 74 sessions::NudgeTracker* nudge_tracker, |
| 77 sessions::SyncSession* session, | 75 sessions::SyncSession* session, |
| 78 const base::TimeDelta& new_delay); | 76 const base::TimeDelta& new_delay); |
| 79 | 77 |
| 80 ACTION_P(SimulateThrottled, throttle) { | 78 ACTION_P(SimulateThrottled, throttle) { |
| 81 SimulateThrottledImpl(arg0, throttle); | 79 SimulateThrottledImpl(arg0, throttle); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 94 } | 92 } |
| 95 | 93 |
| 96 ACTION_P(SimulateGuRetryDelayCommand, delay) { | 94 ACTION_P(SimulateGuRetryDelayCommand, delay) { |
| 97 SimulateGuRetryDelayCommandImpl(arg0, delay); | 95 SimulateGuRetryDelayCommandImpl(arg0, delay); |
| 98 } | 96 } |
| 99 | 97 |
| 100 } // namespace test_util | 98 } // namespace test_util |
| 101 } // namespace sessions | 99 } // namespace sessions |
| 102 } // namespace syncer | 100 } // namespace syncer |
| 103 | 101 |
| 104 #endif // SYNC_SESSIONS_TEST_UTIL_H_ | 102 #endif // COMPONENTS_SYNC_SESSIONS_IMPL_TEST_UTIL_H_ |
| OLD | NEW |