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

Side by Side Diff: components/sync/sessions_impl/test_util.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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
« no previous file with comments | « components/sync/sessions_impl/test_util.h ('k') | components/sync/sync_android.gypi » ('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 #include "sync/sessions/test_util.h" 5 #include "components/sync/sessions_impl/test_util.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 namespace syncer { 9 namespace syncer {
10 namespace sessions { 10 namespace sessions {
11 namespace test_util { 11 namespace test_util {
12 12
13 void SimulateGetEncryptionKeyFailed( 13 void SimulateGetEncryptionKeyFailed(
14 ModelTypeSet requsted_types, 14 ModelTypeSet requsted_types,
15 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, 15 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 NETWORK_CONNECTION_UNAVAILABLE); 79 NETWORK_CONNECTION_UNAVAILABLE);
80 } 80 }
81 81
82 void SimulatePollSuccess(ModelTypeSet requested_types, 82 void SimulatePollSuccess(ModelTypeSet requested_types,
83 sessions::SyncSession* session) { 83 sessions::SyncSession* session) {
84 session->mutable_status_controller()->set_last_download_updates_result( 84 session->mutable_status_controller()->set_last_download_updates_result(
85 SYNCER_OK); 85 SYNCER_OK);
86 } 86 }
87 87
88 void SimulatePollFailed(ModelTypeSet requested_types, 88 void SimulatePollFailed(ModelTypeSet requested_types,
89 sessions::SyncSession* session) { 89 sessions::SyncSession* session) {
90 session->mutable_status_controller()->set_last_download_updates_result( 90 session->mutable_status_controller()->set_last_download_updates_result(
91 SERVER_RETURN_TRANSIENT_ERROR); 91 SERVER_RETURN_TRANSIENT_ERROR);
92 } 92 }
93 93
94 void SimulateThrottledImpl( 94 void SimulateThrottledImpl(sessions::SyncSession* session,
95 sessions::SyncSession* session, 95 const base::TimeDelta& delta) {
96 const base::TimeDelta& delta) {
97 session->mutable_status_controller()->set_last_download_updates_result( 96 session->mutable_status_controller()->set_last_download_updates_result(
98 SERVER_RETURN_THROTTLED); 97 SERVER_RETURN_THROTTLED);
99 session->delegate()->OnThrottled(delta); 98 session->delegate()->OnThrottled(delta);
100 } 99 }
101 100
102 void SimulateTypesThrottledImpl( 101 void SimulateTypesThrottledImpl(sessions::SyncSession* session,
103 sessions::SyncSession* session, 102 ModelTypeSet types,
104 ModelTypeSet types, 103 const base::TimeDelta& delta) {
105 const base::TimeDelta& delta) {
106 session->mutable_status_controller()->set_last_download_updates_result( 104 session->mutable_status_controller()->set_last_download_updates_result(
107 SERVER_RETURN_THROTTLED); 105 SERVER_RETURN_THROTTLED);
108 session->delegate()->OnTypesThrottled(types, delta); 106 session->delegate()->OnTypesThrottled(types, delta);
109 } 107 }
110 108
111 void SimulatePollIntervalUpdateImpl( 109 void SimulatePollIntervalUpdateImpl(ModelTypeSet requested_types,
112 ModelTypeSet requested_types, 110 sessions::SyncSession* session,
113 sessions::SyncSession* session, 111 const base::TimeDelta& new_poll) {
114 const base::TimeDelta& new_poll) {
115 SimulatePollSuccess(requested_types, session); 112 SimulatePollSuccess(requested_types, session);
116 session->delegate()->OnReceivedLongPollIntervalUpdate(new_poll); 113 session->delegate()->OnReceivedLongPollIntervalUpdate(new_poll);
117 } 114 }
118 115
119 void SimulateSessionsCommitDelayUpdateImpl( 116 void SimulateSessionsCommitDelayUpdateImpl(
120 ModelTypeSet requested_types, 117 ModelTypeSet requested_types,
121 sessions::NudgeTracker* nudge_tracker, 118 sessions::NudgeTracker* nudge_tracker,
122 sessions::SyncSession* session, 119 sessions::SyncSession* session,
123 const base::TimeDelta& new_delay) { 120 const base::TimeDelta& new_delay) {
124 SimulateNormalSuccess(requested_types, nudge_tracker, session); 121 SimulateNormalSuccess(requested_types, nudge_tracker, session);
125 std::map<ModelType, base::TimeDelta> delay_map; 122 std::map<ModelType, base::TimeDelta> delay_map;
126 delay_map[SESSIONS] = new_delay; 123 delay_map[SESSIONS] = new_delay;
127 session->delegate()->OnReceivedCustomNudgeDelays(delay_map); 124 session->delegate()->OnReceivedCustomNudgeDelays(delay_map);
128 } 125 }
129 126
130 void SimulateGuRetryDelayCommandImpl(sessions::SyncSession* session, 127 void SimulateGuRetryDelayCommandImpl(sessions::SyncSession* session,
131 base::TimeDelta delay) { 128 base::TimeDelta delay) {
132 session->mutable_status_controller()->set_last_download_updates_result( 129 session->mutable_status_controller()->set_last_download_updates_result(
133 SYNCER_OK); 130 SYNCER_OK);
134 session->delegate()->OnReceivedGuRetryDelay(delay); 131 session->delegate()->OnReceivedGuRetryDelay(delay);
135 } 132 }
136 133
137 } // namespace test_util 134 } // namespace test_util
138 } // namespace sessions 135 } // namespace sessions
139 } // namespace syncer 136 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/sessions_impl/test_util.h ('k') | components/sync/sync_android.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698