| 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 |
| 11 void SimulateGetEncryptionKeyFailed(ModelTypeSet requsted_types, | 11 void SimulateGetEncryptionKeyFailed( |
| 12 sessions::SyncSession* session) { | 12 ModelTypeSet requsted_types, |
| 13 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, |
| 14 sessions::SyncSession* session) { |
| 13 session->mutable_status_controller()->set_last_get_key_result( | 15 session->mutable_status_controller()->set_last_get_key_result( |
| 14 SERVER_RESPONSE_VALIDATION_FAILED); | 16 SERVER_RESPONSE_VALIDATION_FAILED); |
| 15 session->mutable_status_controller()->set_last_download_updates_result( | 17 session->mutable_status_controller()->set_last_download_updates_result( |
| 16 SYNCER_OK); | 18 SYNCER_OK); |
| 17 } | 19 } |
| 18 | 20 |
| 19 void SimulateConfigureSuccess(ModelTypeSet requsted_types, | 21 void SimulateConfigureSuccess( |
| 20 sessions::SyncSession* session) { | 22 ModelTypeSet requsted_types, |
| 23 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, |
| 24 sessions::SyncSession* session) { |
| 21 ASSERT_EQ(0U, session->status_controller().num_server_changes_remaining()); | 25 ASSERT_EQ(0U, session->status_controller().num_server_changes_remaining()); |
| 22 session->mutable_status_controller()->set_last_get_key_result(SYNCER_OK); | 26 session->mutable_status_controller()->set_last_get_key_result(SYNCER_OK); |
| 23 session->mutable_status_controller()->set_last_download_updates_result( | 27 session->mutable_status_controller()->set_last_download_updates_result( |
| 24 SYNCER_OK); | 28 SYNCER_OK); |
| 25 } | 29 } |
| 26 | 30 |
| 27 void SimulateConfigureFailed(ModelTypeSet requsted_types, | 31 void SimulateConfigureFailed( |
| 28 sessions::SyncSession* session) { | 32 ModelTypeSet requsted_types, |
| 33 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, |
| 34 sessions::SyncSession* session) { |
| 29 session->mutable_status_controller()->set_last_get_key_result(SYNCER_OK); | 35 session->mutable_status_controller()->set_last_get_key_result(SYNCER_OK); |
| 30 session->mutable_status_controller()->set_last_download_updates_result( | 36 session->mutable_status_controller()->set_last_download_updates_result( |
| 31 SERVER_RETURN_TRANSIENT_ERROR); | 37 SERVER_RETURN_TRANSIENT_ERROR); |
| 32 } | 38 } |
| 33 | 39 |
| 34 void SimulateConfigureConnectionFailure(ModelTypeSet requsted_types, | 40 void SimulateConfigureConnectionFailure( |
| 35 sessions::SyncSession* session) { | 41 ModelTypeSet requsted_types, |
| 42 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, |
| 43 sessions::SyncSession* session) { |
| 36 session->mutable_status_controller()->set_last_get_key_result(SYNCER_OK); | 44 session->mutable_status_controller()->set_last_get_key_result(SYNCER_OK); |
| 37 session->mutable_status_controller()->set_last_download_updates_result( | 45 session->mutable_status_controller()->set_last_download_updates_result( |
| 38 NETWORK_CONNECTION_UNAVAILABLE); | 46 NETWORK_CONNECTION_UNAVAILABLE); |
| 39 } | 47 } |
| 40 | 48 |
| 41 void SimulateNormalSuccess(ModelTypeSet requested_types, | 49 void SimulateNormalSuccess(ModelTypeSet requested_types, |
| 42 const sessions::NudgeTracker& nudge_tracker, | 50 const sessions::NudgeTracker& nudge_tracker, |
| 43 sessions::SyncSession* session) { | 51 sessions::SyncSession* session) { |
| 44 ASSERT_EQ(0U, session->status_controller().num_server_changes_remaining()); | 52 ASSERT_EQ(0U, session->status_controller().num_server_changes_remaining()); |
| 45 session->mutable_status_controller()->set_commit_result(SYNCER_OK); | 53 session->mutable_status_controller()->set_commit_result(SYNCER_OK); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 const sessions::NudgeTracker& nudge_tracker, | 125 const sessions::NudgeTracker& nudge_tracker, |
| 118 sessions::SyncSession* session, | 126 sessions::SyncSession* session, |
| 119 const base::TimeDelta& new_delay) { | 127 const base::TimeDelta& new_delay) { |
| 120 SimulateNormalSuccess(requested_types, nudge_tracker, session); | 128 SimulateNormalSuccess(requested_types, nudge_tracker, session); |
| 121 session->delegate()->OnReceivedSessionsCommitDelay(new_delay); | 129 session->delegate()->OnReceivedSessionsCommitDelay(new_delay); |
| 122 } | 130 } |
| 123 | 131 |
| 124 } // namespace test_util | 132 } // namespace test_util |
| 125 } // namespace sessions | 133 } // namespace sessions |
| 126 } // namespace syncer | 134 } // namespace syncer |
| OLD | NEW |