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

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

Issue 5939006: sync: beginnings of MessageLoop based SyncerThread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: linux compile Created 9 years, 11 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
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/sync/sessions/test_util.h"
6
7 namespace browser_sync {
8 namespace sessions {
9 namespace test_util {
10
11 void SimulateHasMoreToSync(sessions::SyncSession* session) {
12 session->status_controller()->update_conflicts_resolved(true);
13 ASSERT_TRUE(session->HasMoreToSync());
14 }
15
16 void SimulateDownloadUpdatesFailed(sessions::SyncSession* session) {
17 // Note that a non-zero value of changes_remaining once a session has
18 // completed implies that the Syncer was unable to exhaust this count during
19 // the GetUpdates cycle. This is an indication that an error occurred.
20 session->status_controller()->set_num_server_changes_remaining(1);
21 }
22
23 void SimulateCommitFailed(sessions::SyncSession* session) {
24 // Note that a non-zero number of unsynced handles once a session has
25 // completed implies that the Syncer was unable to make forward progress
26 // during a commit, indicating an error occurred.
27 // See implementation of SyncSession::HasMoreToSync.
28 std::vector<int64> handles;
29 handles.push_back(1);
30 session->status_controller()->set_unsynced_handles(handles);
31 }
32
33 void SimulateSuccess(sessions::SyncSession* session) {
34 if (session->HasMoreToSync()) {
35 ADD_FAILURE() << "Shouldn't have more to sync";
36 }
37 ASSERT_EQ(0U, session->status_controller()->num_server_changes_remaining());
38 ASSERT_EQ(0U, session->status_controller()->unsynced_handles().size());
39 }
40
41 void SimulateThrottledImpl(sessions::SyncSession* session,
42 const base::TimeDelta& delta) {
43 session->delegate()->OnSilencedUntil(base::TimeTicks::Now() + delta);
44 }
45
46 void SimulatePollIntervalUpdateImpl(sessions::SyncSession* session,
47 const base::TimeDelta& new_poll) {
48 session->delegate()->OnReceivedLongPollIntervalUpdate(new_poll);
49 }
50
51 } // namespace test_util
52 } // namespace sessions
53 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/sessions/test_util.h ('k') | chrome/browser/sync/test_profile_sync_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698