| 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 #ifndef SYNC_TEST_ENGINE_SYNCER_COMMAND_TEST_H_ | 5 #ifndef SYNC_TEST_ENGINE_SYNCER_COMMAND_TEST_H_ |
| 6 #define SYNC_TEST_ENGINE_SYNCER_COMMAND_TEST_H_ | 6 #define SYNC_TEST_ENGINE_SYNCER_COMMAND_TEST_H_ |
| 7 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 100 |
| 101 // Lazily create a session requesting all datatypes with no state. | 101 // Lazily create a session requesting all datatypes with no state. |
| 102 sessions::SyncSession* session() { | 102 sessions::SyncSession* session() { |
| 103 ModelTypeInvalidationMap types = | 103 ModelTypeInvalidationMap types = |
| 104 ModelSafeRoutingInfoToInvalidationMap(routing_info_, std::string()); | 104 ModelSafeRoutingInfoToInvalidationMap(routing_info_, std::string()); |
| 105 return session(sessions::SyncSourceInfo(types)); | 105 return session(sessions::SyncSourceInfo(types)); |
| 106 } | 106 } |
| 107 | 107 |
| 108 // Create a session with the provided source. | 108 // Create a session with the provided source. |
| 109 sessions::SyncSession* session(const sessions::SyncSourceInfo& source) { | 109 sessions::SyncSession* session(const sessions::SyncSourceInfo& source) { |
| 110 if (!session_) { | 110 // These sources require a valid nudge tracker. |
| 111 DCHECK_NE(sync_pb::GetUpdatesCallerInfo::LOCAL, source.updates_source); |
| 112 DCHECK_NE(sync_pb::GetUpdatesCallerInfo::NOTIFICATION, |
| 113 source.updates_source); |
| 114 DCHECK_NE(sync_pb::GetUpdatesCallerInfo::DATATYPE_REFRESH, |
| 115 source.updates_source); |
| 116 if (!session_.get()) { |
| 111 std::vector<ModelSafeWorker*> workers = GetWorkers(); | 117 std::vector<ModelSafeWorker*> workers = GetWorkers(); |
| 112 session_.reset(new sessions::SyncSession(context(), delegate(), source)); | 118 session_.reset( |
| 119 sessions::SyncSession::BuildForNonNudge( |
| 120 context(), |
| 121 delegate(), |
| 122 source)); |
| 113 } | 123 } |
| 114 return session_.get(); | 124 return session_.get(); |
| 115 } | 125 } |
| 116 | 126 |
| 117 void ClearSession() { | 127 void ClearSession() { |
| 118 session_.reset(); | 128 session_.reset(); |
| 119 } | 129 } |
| 120 | 130 |
| 121 void ResetContext() { | 131 void ResetContext() { |
| 122 throttled_data_type_tracker_.reset(new ThrottledDataTypeTracker(NULL)); | 132 throttled_data_type_tracker_.reset(new ThrottledDataTypeTracker(NULL)); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 | 239 |
| 230 virtual void SetUp() OVERRIDE; | 240 virtual void SetUp() OVERRIDE; |
| 231 | 241 |
| 232 TestUnrecoverableErrorHandler handler_; | 242 TestUnrecoverableErrorHandler handler_; |
| 233 syncable::MockDirectory mock_directory_; | 243 syncable::MockDirectory mock_directory_; |
| 234 }; | 244 }; |
| 235 | 245 |
| 236 } // namespace syncer | 246 } // namespace syncer |
| 237 | 247 |
| 238 #endif // SYNC_TEST_ENGINE_SYNCER_COMMAND_TEST_H_ | 248 #endif // SYNC_TEST_ENGINE_SYNCER_COMMAND_TEST_H_ |
| OLD | NEW |