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

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

Issue 11314008: sync: Follow-up to conflict resolution refactor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests Created 8 years, 1 month 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/test_util.h ('k') | sync/sync.gyp » ('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 "sync/sessions/test_util.h"
6 6
7 namespace syncer { 7 namespace syncer {
8 namespace sessions { 8 namespace sessions {
9 namespace test_util { 9 namespace test_util {
10 10
11 void SimulateHasMoreToSync(sessions::SyncSession* session,
12 SyncerStep begin, SyncerStep end) {
13 session->mutable_status_controller()->update_conflicts_resolved(true);
14 ASSERT_TRUE(session->HasMoreToSync());
15 }
16
17 void SimulateGetEncryptionKeyFailed(sessions::SyncSession* session, 11 void SimulateGetEncryptionKeyFailed(sessions::SyncSession* session,
18 SyncerStep begin, SyncerStep end) { 12 SyncerStep begin, SyncerStep end) {
19 session->mutable_status_controller()->set_last_get_key_result( 13 session->mutable_status_controller()->set_last_get_key_result(
20 SERVER_RESPONSE_VALIDATION_FAILED); 14 SERVER_RESPONSE_VALIDATION_FAILED);
21 session->mutable_status_controller()->set_last_download_updates_result( 15 session->mutable_status_controller()->set_last_download_updates_result(
22 SYNCER_OK); 16 SYNCER_OK);
23 } 17 }
24 18
25 void SimulateDownloadUpdatesFailed(sessions::SyncSession* session, 19 void SimulateDownloadUpdatesFailed(sessions::SyncSession* session,
26 SyncerStep begin, SyncerStep end) { 20 SyncerStep begin, SyncerStep end) {
(...skipping 12 matching lines...) Expand all
39 } 33 }
40 34
41 void SimulateConnectionFailure(sessions::SyncSession* session, 35 void SimulateConnectionFailure(sessions::SyncSession* session,
42 SyncerStep begin, SyncerStep end) { 36 SyncerStep begin, SyncerStep end) {
43 session->mutable_status_controller()->set_last_download_updates_result( 37 session->mutable_status_controller()->set_last_download_updates_result(
44 NETWORK_CONNECTION_UNAVAILABLE); 38 NETWORK_CONNECTION_UNAVAILABLE);
45 } 39 }
46 40
47 void SimulateSuccess(sessions::SyncSession* session, 41 void SimulateSuccess(sessions::SyncSession* session,
48 SyncerStep begin, SyncerStep end) { 42 SyncerStep begin, SyncerStep end) {
49 if (session->HasMoreToSync()) {
50 ADD_FAILURE() << "Shouldn't have more to sync";
51 }
52 ASSERT_EQ(0U, session->status_controller().num_server_changes_remaining()); 43 ASSERT_EQ(0U, session->status_controller().num_server_changes_remaining());
53 switch(end) { 44 switch(end) {
54 case SYNCER_END: 45 case SYNCER_END:
55 session->mutable_status_controller()->set_commit_result(SYNCER_OK); 46 session->mutable_status_controller()->set_commit_result(SYNCER_OK);
56 // Fall through. 47 // Fall through.
57 case APPLY_UPDATES: 48 case APPLY_UPDATES:
58 DCHECK_EQ(end == APPLY_UPDATES, session->source().updates_source == 49 DCHECK_EQ(end == APPLY_UPDATES, session->source().updates_source ==
59 sync_pb::GetUpdatesCallerInfo::RECONFIGURATION); 50 sync_pb::GetUpdatesCallerInfo::RECONFIGURATION);
60 session->mutable_status_controller()->set_last_get_key_result(SYNCER_OK); 51 session->mutable_status_controller()->set_last_get_key_result(SYNCER_OK);
61 session->mutable_status_controller()->set_last_download_updates_result( 52 session->mutable_status_controller()->set_last_download_updates_result(
(...skipping 19 matching lines...) Expand all
81 72
82 void SimulateSessionsCommitDelayUpdateImpl(sessions::SyncSession* session, 73 void SimulateSessionsCommitDelayUpdateImpl(sessions::SyncSession* session,
83 const base::TimeDelta& new_delay) { 74 const base::TimeDelta& new_delay) {
84 SimulateSuccess(session, SYNCER_BEGIN, SYNCER_END); 75 SimulateSuccess(session, SYNCER_BEGIN, SYNCER_END);
85 session->delegate()->OnReceivedSessionsCommitDelay(new_delay); 76 session->delegate()->OnReceivedSessionsCommitDelay(new_delay);
86 } 77 }
87 78
88 } // namespace test_util 79 } // namespace test_util
89 } // namespace sessions 80 } // namespace sessions
90 } // namespace syncer 81 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/sessions/test_util.h ('k') | sync/sync.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698