| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback.h" | 6 #include "base/callback.h" |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 routing_info_[BOOKMARKS] = GROUP_UI; | 118 routing_info_[BOOKMARKS] = GROUP_UI; |
| 119 routing_info_[AUTOFILL] = GROUP_DB; | 119 routing_info_[AUTOFILL] = GROUP_DB; |
| 120 routing_info_[THEMES] = GROUP_UI; | 120 routing_info_[THEMES] = GROUP_UI; |
| 121 routing_info_[NIGORI] = GROUP_PASSIVE; | 121 routing_info_[NIGORI] = GROUP_PASSIVE; |
| 122 | 122 |
| 123 workers_.clear(); | 123 workers_.clear(); |
| 124 workers_.push_back(make_scoped_refptr(new FakeModelWorker(GROUP_UI))); | 124 workers_.push_back(make_scoped_refptr(new FakeModelWorker(GROUP_UI))); |
| 125 workers_.push_back(make_scoped_refptr(new FakeModelWorker(GROUP_DB))); | 125 workers_.push_back(make_scoped_refptr(new FakeModelWorker(GROUP_DB))); |
| 126 workers_.push_back(make_scoped_refptr(new FakeModelWorker(GROUP_PASSIVE))); | 126 workers_.push_back(make_scoped_refptr(new FakeModelWorker(GROUP_PASSIVE))); |
| 127 | 127 |
| 128 std::vector<ModelSafeWorker*> workers; | |
| 129 for (std::vector<scoped_refptr<FakeModelWorker> >::iterator it = | |
| 130 workers_.begin(); it != workers_.end(); ++it) { | |
| 131 workers.push_back(it->get()); | |
| 132 } | |
| 133 | |
| 134 connection_.reset(new MockConnectionManager(directory(), | 128 connection_.reset(new MockConnectionManager(directory(), |
| 135 &cancelation_signal_)); | 129 &cancelation_signal_)); |
| 136 connection_->SetServerReachable(); | 130 connection_->SetServerReachable(); |
| 137 context_.reset(new SyncSessionContext( | 131 context_.reset(new SyncSessionContext( |
| 138 connection_.get(), directory(), workers, | 132 connection_.get(), directory(), workers_, |
| 139 extensions_activity_.get(), | 133 extensions_activity_.get(), |
| 140 std::vector<SyncEngineEventListener*>(), NULL, NULL, | 134 std::vector<SyncEngineEventListener*>(), NULL, NULL, |
| 141 true, // enable keystore encryption | 135 true, // enable keystore encryption |
| 142 false, // force enable pre-commit GU avoidance | 136 false, // force enable pre-commit GU avoidance |
| 143 "fake_invalidator_client_id")); | 137 "fake_invalidator_client_id")); |
| 144 context_->set_routing_info(routing_info_); | 138 context_->set_routing_info(routing_info_); |
| 145 context_->set_notifications_enabled(true); | 139 context_->set_notifications_enabled(true); |
| 146 context_->set_account_name("Test"); | 140 context_->set_account_name("Test"); |
| 147 scheduler_.reset( | 141 scheduler_.reset( |
| 148 new SyncSchedulerImpl("TestSyncScheduler", | 142 new SyncSchedulerImpl("TestSyncScheduler", |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 } | 216 } |
| 223 | 217 |
| 224 base::MessageLoop loop_; | 218 base::MessageLoop loop_; |
| 225 TestDirectorySetterUpper dir_maker_; | 219 TestDirectorySetterUpper dir_maker_; |
| 226 CancelationSignal cancelation_signal_; | 220 CancelationSignal cancelation_signal_; |
| 227 scoped_ptr<MockConnectionManager> connection_; | 221 scoped_ptr<MockConnectionManager> connection_; |
| 228 scoped_ptr<SyncSessionContext> context_; | 222 scoped_ptr<SyncSessionContext> context_; |
| 229 scoped_ptr<SyncSchedulerImpl> scheduler_; | 223 scoped_ptr<SyncSchedulerImpl> scheduler_; |
| 230 MockSyncer* syncer_; | 224 MockSyncer* syncer_; |
| 231 MockDelayProvider* delay_; | 225 MockDelayProvider* delay_; |
| 232 std::vector<scoped_refptr<FakeModelWorker> > workers_; | 226 std::vector<scoped_refptr<ModelSafeWorker> > workers_; |
| 233 scoped_refptr<ExtensionsActivity> extensions_activity_; | 227 scoped_refptr<ExtensionsActivity> extensions_activity_; |
| 234 ModelSafeRoutingInfo routing_info_; | 228 ModelSafeRoutingInfo routing_info_; |
| 235 base::WeakPtrFactory<SyncSchedulerTest> weak_ptr_factory_; | 229 base::WeakPtrFactory<SyncSchedulerTest> weak_ptr_factory_; |
| 236 }; | 230 }; |
| 237 | 231 |
| 238 void RecordSyncShareImpl(SyncShareTimes* times) { | 232 void RecordSyncShareImpl(SyncShareTimes* times) { |
| 239 times->push_back(TimeTicks::Now()); | 233 times->push_back(TimeTicks::Now()); |
| 240 } | 234 } |
| 241 | 235 |
| 242 ACTION_P(RecordSyncShare, times) { | 236 ACTION_P(RecordSyncShare, times) { |
| (...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1290 EXPECT_CALL(*syncer(), PollSyncShare(_,_)) | 1284 EXPECT_CALL(*syncer(), PollSyncShare(_,_)) |
| 1291 .WillOnce(DoAll(Invoke(sessions::test_util::SimulatePollSuccess), | 1285 .WillOnce(DoAll(Invoke(sessions::test_util::SimulatePollSuccess), |
| 1292 RecordSyncShare(×))); | 1286 RecordSyncShare(×))); |
| 1293 scheduler()->OnCredentialsUpdated(); | 1287 scheduler()->OnCredentialsUpdated(); |
| 1294 connection()->SetServerStatus(HttpResponse::SERVER_CONNECTION_OK); | 1288 connection()->SetServerStatus(HttpResponse::SERVER_CONNECTION_OK); |
| 1295 RunLoop(); | 1289 RunLoop(); |
| 1296 StopSyncScheduler(); | 1290 StopSyncScheduler(); |
| 1297 } | 1291 } |
| 1298 | 1292 |
| 1299 } // namespace syncer | 1293 } // namespace syncer |
| OLD | NEW |