OLD | NEW |
| (Empty) |
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 | |
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 SyncerStep begin, SyncerStep end) { | |
13 session->mutable_status_controller()->update_conflicts_resolved(true); | |
14 ASSERT_TRUE(session->HasMoreToSync()); | |
15 } | |
16 | |
17 void SimulateDownloadUpdatesFailed(sessions::SyncSession* session, | |
18 SyncerStep begin, SyncerStep end) { | |
19 session->mutable_status_controller()->set_last_download_updates_result( | |
20 SERVER_RETURN_TRANSIENT_ERROR); | |
21 } | |
22 | |
23 void SimulateCommitFailed(sessions::SyncSession* session, | |
24 SyncerStep begin, SyncerStep end) { | |
25 session->mutable_status_controller()->set_last_post_commit_result( | |
26 SERVER_RETURN_TRANSIENT_ERROR); | |
27 } | |
28 | |
29 void SimulateSuccess(sessions::SyncSession* session, | |
30 SyncerStep begin, SyncerStep end) { | |
31 if (session->HasMoreToSync()) { | |
32 ADD_FAILURE() << "Shouldn't have more to sync"; | |
33 } | |
34 ASSERT_EQ(0U, session->status_controller().num_server_changes_remaining()); | |
35 ASSERT_EQ(0U, session->status_controller().unsynced_handles().size()); | |
36 } | |
37 | |
38 void SimulateThrottledImpl(sessions::SyncSession* session, | |
39 const base::TimeDelta& delta) { | |
40 session->delegate()->OnSilencedUntil(base::TimeTicks::Now() + delta); | |
41 } | |
42 | |
43 void SimulatePollIntervalUpdateImpl(sessions::SyncSession* session, | |
44 const base::TimeDelta& new_poll) { | |
45 session->delegate()->OnReceivedLongPollIntervalUpdate(new_poll); | |
46 } | |
47 | |
48 void SimulateSessionsCommitDelayUpdateImpl(sessions::SyncSession* session, | |
49 const base::TimeDelta& new_delay) { | |
50 session->delegate()->OnReceivedSessionsCommitDelay(new_delay); | |
51 } | |
52 | |
53 } // namespace test_util | |
54 } // namespace sessions | |
55 } // namespace browser_sync | |
OLD | NEW |