| OLD | NEW |
| 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 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 NETWORK_CONNECTION_UNAVAILABLE); | 41 NETWORK_CONNECTION_UNAVAILABLE); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void SimulateSuccess(sessions::SyncSession* session, | 44 void SimulateSuccess(sessions::SyncSession* session, |
| 45 SyncerStep begin, SyncerStep end) { | 45 SyncerStep begin, SyncerStep end) { |
| 46 if (session->HasMoreToSync()) { | 46 if (session->HasMoreToSync()) { |
| 47 ADD_FAILURE() << "Shouldn't have more to sync"; | 47 ADD_FAILURE() << "Shouldn't have more to sync"; |
| 48 } | 48 } |
| 49 ASSERT_EQ(0U, session->status_controller().num_server_changes_remaining()); | 49 ASSERT_EQ(0U, session->status_controller().num_server_changes_remaining()); |
| 50 session->SetFinished(); | 50 session->SetFinished(); |
| 51 if (end == SYNCER_END) { | 51 switch(end) { |
| 52 session->mutable_status_controller()->set_last_get_key_result(SYNCER_OK); | 52 case SYNCER_END: |
| 53 session->mutable_status_controller()->set_last_download_updates_result( | 53 session->mutable_status_controller()->set_commit_result(SYNCER_OK); |
| 54 SYNCER_OK); | 54 // Fall through. |
| 55 session->mutable_status_controller()->set_commit_result(SYNCER_OK); | 55 case APPLY_UPDATES: |
| 56 DCHECK_EQ(end == APPLY_UPDATES, session->source().updates_source == |
| 57 sync_pb::GetUpdatesCallerInfo::RECONFIGURATION); |
| 58 session->mutable_status_controller()->set_last_get_key_result(SYNCER_OK); |
| 59 session->mutable_status_controller()->set_last_download_updates_result( |
| 60 SYNCER_OK); |
| 61 break; |
| 62 default: |
| 63 ADD_FAILURE() << "Not a valid END state."; |
| 56 } | 64 } |
| 57 } | 65 } |
| 58 | 66 |
| 59 void SimulateThrottledImpl(sessions::SyncSession* session, | 67 void SimulateThrottledImpl(sessions::SyncSession* session, |
| 60 const base::TimeDelta& delta) { | 68 const base::TimeDelta& delta) { |
| 61 session->delegate()->OnSilencedUntil(base::TimeTicks::Now() + delta); | 69 session->delegate()->OnSilencedUntil(base::TimeTicks::Now() + delta); |
| 62 } | 70 } |
| 63 | 71 |
| 64 void SimulatePollIntervalUpdateImpl(sessions::SyncSession* session, | 72 void SimulatePollIntervalUpdateImpl(sessions::SyncSession* session, |
| 65 const base::TimeDelta& new_poll) { | 73 const base::TimeDelta& new_poll) { |
| 66 session->delegate()->OnReceivedLongPollIntervalUpdate(new_poll); | 74 session->delegate()->OnReceivedLongPollIntervalUpdate(new_poll); |
| 67 } | 75 } |
| 68 | 76 |
| 69 void SimulateSessionsCommitDelayUpdateImpl(sessions::SyncSession* session, | 77 void SimulateSessionsCommitDelayUpdateImpl(sessions::SyncSession* session, |
| 70 const base::TimeDelta& new_delay) { | 78 const base::TimeDelta& new_delay) { |
| 71 session->delegate()->OnReceivedSessionsCommitDelay(new_delay); | 79 session->delegate()->OnReceivedSessionsCommitDelay(new_delay); |
| 72 } | 80 } |
| 73 | 81 |
| 74 } // namespace test_util | 82 } // namespace test_util |
| 75 } // namespace sessions | 83 } // namespace sessions |
| 76 } // namespace syncer | 84 } // namespace syncer |
| OLD | NEW |