| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 FAIL() << "Should not get poll interval update."; | 61 FAIL() << "Should not get poll interval update."; |
| 62 } | 62 } |
| 63 virtual void OnReceivedShortPollIntervalUpdate( | 63 virtual void OnReceivedShortPollIntervalUpdate( |
| 64 const base::TimeDelta& new_interval) OVERRIDE { | 64 const base::TimeDelta& new_interval) OVERRIDE { |
| 65 FAIL() << "Should not get poll interval update."; | 65 FAIL() << "Should not get poll interval update."; |
| 66 } | 66 } |
| 67 virtual void OnReceivedSessionsCommitDelay( | 67 virtual void OnReceivedSessionsCommitDelay( |
| 68 const base::TimeDelta& new_delay) OVERRIDE { | 68 const base::TimeDelta& new_delay) OVERRIDE { |
| 69 FAIL() << "Should not get sessions commit delay."; | 69 FAIL() << "Should not get sessions commit delay."; |
| 70 } | 70 } |
| 71 virtual void OnReceivedClientInvalidationHintBufferSize(int size) OVERRIDE { |
| 72 FAIL() << "Should not get hint buffer size."; |
| 73 } |
| 71 virtual void OnShouldStopSyncingPermanently() OVERRIDE { | 74 virtual void OnShouldStopSyncingPermanently() OVERRIDE { |
| 72 FAIL() << "Shouldn't be called."; | 75 FAIL() << "Shouldn't be called."; |
| 73 } | 76 } |
| 74 virtual void OnSyncProtocolError( | 77 virtual void OnSyncProtocolError( |
| 75 const sessions::SyncSessionSnapshot& session) OVERRIDE { | 78 const sessions::SyncSessionSnapshot& session) OVERRIDE { |
| 76 return; | 79 return; |
| 77 } | 80 } |
| 78 | 81 |
| 79 std::vector<ModelSafeWorker*> GetWorkers() { | 82 std::vector<ModelSafeWorker*> GetWorkers() { |
| 80 std::vector<ModelSafeWorker*> workers; | 83 std::vector<ModelSafeWorker*> workers; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 100 | 103 |
| 101 // Lazily create a session requesting all datatypes with no state. | 104 // Lazily create a session requesting all datatypes with no state. |
| 102 sessions::SyncSession* session() { | 105 sessions::SyncSession* session() { |
| 103 ModelTypeInvalidationMap types = | 106 ModelTypeInvalidationMap types = |
| 104 ModelSafeRoutingInfoToInvalidationMap(routing_info_, std::string()); | 107 ModelSafeRoutingInfoToInvalidationMap(routing_info_, std::string()); |
| 105 return session(sessions::SyncSourceInfo(types)); | 108 return session(sessions::SyncSourceInfo(types)); |
| 106 } | 109 } |
| 107 | 110 |
| 108 // Create a session with the provided source. | 111 // Create a session with the provided source. |
| 109 sessions::SyncSession* session(const sessions::SyncSourceInfo& source) { | 112 sessions::SyncSession* session(const sessions::SyncSourceInfo& source) { |
| 110 if (!session_) { | 113 // These sources require a valid nudge tracker. |
| 114 DCHECK_NE(sync_pb::GetUpdatesCallerInfo::LOCAL, source.updates_source); |
| 115 DCHECK_NE(sync_pb::GetUpdatesCallerInfo::NOTIFICATION, |
| 116 source.updates_source); |
| 117 DCHECK_NE(sync_pb::GetUpdatesCallerInfo::DATATYPE_REFRESH, |
| 118 source.updates_source); |
| 119 if (!session_.get()) { |
| 111 std::vector<ModelSafeWorker*> workers = GetWorkers(); | 120 std::vector<ModelSafeWorker*> workers = GetWorkers(); |
| 112 session_.reset(new sessions::SyncSession(context(), delegate(), source)); | 121 session_.reset( |
| 122 sessions::SyncSession::Build(context(), delegate(), 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 |