Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Side by Side Diff: sync/sessions/test_util.h

Issue 17052007: sync: Expose sync functionality as functions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Finish addressing latest review comments Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/sessions/sync_session.cc ('k') | sync/sessions/test_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 SYNC_SESSIONS_TEST_UTIL_H_
7 #define SYNC_SESSIONS_TEST_UTIL_H_ 7 #define SYNC_SESSIONS_TEST_UTIL_H_
8 8
9 #include "sync/engine/syncer.h" 9 #include "sync/engine/syncer.h"
10 #include "sync/sessions/sync_session.h" 10 #include "sync/sessions/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 void SimulateGetEncryptionKeyFailed(sessions::SyncSession* session, 18 // Configure sync cycle successes and failures.
19 SyncerStep begin, SyncerStep end); 19 void SimulateGetEncryptionKeyFailed(ModelTypeSet requested_types,
20 void SimulateDownloadUpdatesFailed(sessions::SyncSession* session, 20 sessions::SyncSession* session);
21 SyncerStep begin, SyncerStep end); 21 void SimulateConfigureSuccess(ModelTypeSet requested_types,
22 void SimulateCommitFailed(sessions::SyncSession* session, 22 sessions::SyncSession* session);
23 SyncerStep begin, SyncerStep end); 23 void SimulateConfigureFailed(ModelTypeSet requested_types,
24 void SimulateConnectionFailure(sessions::SyncSession* session, 24 sessions::SyncSession* session);
25 SyncerStep begin, SyncerStep end); 25 void SimulateConfigureConnectionFailure(ModelTypeSet requested_types,
26 void SimulateSuccess(sessions::SyncSession* session, 26 sessions::SyncSession* session);
27 SyncerStep begin, SyncerStep end); 27
28 // Normal mode sync cycle successes and failures.
29 void SimulateNormalSuccess(ModelTypeSet requested_types,
30 const sessions::NudgeTracker& nudge_tracker,
31 sessions::SyncSession* session);
32 void SimulateDownloadUpdatesFailed(ModelTypeSet requested_types,
33 const sessions::NudgeTracker& nudge_tracker,
34 sessions::SyncSession* session);
35 void SimulateCommitFailed(ModelTypeSet requested_types,
36 const sessions::NudgeTracker& nudge_tracker,
37 sessions::SyncSession* session);
38 void SimulateConnectionFailure(ModelTypeSet requested_types,
39 const sessions::NudgeTracker& nudge_tracker,
40 sessions::SyncSession* session);
41
42 // Poll successes and failures.
43 void SimulatePollSuccess(ModelTypeSet requested_types,
44 sessions::SyncSession* session);
45 void SimulatePollFailed(ModelTypeSet requested_types,
46 sessions::SyncSession* session);
47
28 void SimulateThrottledImpl(sessions::SyncSession* session, 48 void SimulateThrottledImpl(sessions::SyncSession* session,
29 const base::TimeDelta& delta); 49 const base::TimeDelta& delta);
50
30 void SimulateTypesThrottledImpl( 51 void SimulateTypesThrottledImpl(
31 sessions::SyncSession* session, 52 sessions::SyncSession* session,
32 ModelTypeSet types, 53 ModelTypeSet types,
33 const base::TimeDelta& delta); 54 const base::TimeDelta& delta);
34 void SimulatePollIntervalUpdateImpl(sessions::SyncSession* session, 55
56 // Works with poll cycles.
57 void SimulatePollIntervalUpdateImpl(
58 ModelTypeSet requested_types,
59 sessions::SyncSession* session,
35 const base::TimeDelta& new_poll); 60 const base::TimeDelta& new_poll);
36 void SimulateSessionsCommitDelayUpdateImpl(sessions::SyncSession* session, 61
62 // Works with normal cycles.
63 void SimulateSessionsCommitDelayUpdateImpl(
64 ModelTypeSet requested_types,
65 const sessions::NudgeTracker& nudge_tracker,
66 sessions::SyncSession* session,
37 const base::TimeDelta& new_delay); 67 const base::TimeDelta& new_delay);
38 68
39 ACTION_P(SimulateThrottled, throttle) { 69 ACTION_P(SimulateThrottled, throttle) {
40 SimulateThrottledImpl(arg0, throttle); 70 SimulateThrottledImpl(arg0, throttle);
41 } 71 }
42 72
43 ACTION_P2(SimulateTypesThrottled, types, throttle) { 73 ACTION_P2(SimulateTypesThrottled, types, throttle) {
44 SimulateTypesThrottledImpl(arg0, types, throttle); 74 SimulateTypesThrottledImpl(arg0, types, throttle);
45 } 75 }
46 76
47 ACTION_P(SimulatePollIntervalUpdate, poll) { 77 ACTION_P(SimulatePollIntervalUpdate, poll) {
48 SimulatePollIntervalUpdateImpl(arg0, poll); 78 SimulatePollIntervalUpdateImpl(arg0, arg1, poll);
49 } 79 }
50 80
51 ACTION_P(SimulateSessionsCommitDelayUpdate, poll) { 81 ACTION_P(SimulateSessionsCommitDelayUpdate, poll) {
52 SimulateSessionsCommitDelayUpdateImpl(arg0, poll); 82 SimulateSessionsCommitDelayUpdateImpl(arg0, arg1, arg2, poll);
53 } 83 }
54 84
55 } // namespace test_util 85 } // namespace test_util
56 } // namespace sessions 86 } // namespace sessions
57 } // namespace syncer 87 } // namespace syncer
58 88
59 #endif // SYNC_SESSIONS_TEST_UTIL_H_ 89 #endif // SYNC_SESSIONS_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « sync/sessions/sync_session.cc ('k') | sync/sessions/test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698