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.h" | 9 #include "base/message_loop.h" |
10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
| 11 #include "sync/engine/throttled_data_type_tracker.h" |
11 #include "sync/engine/sync_scheduler.h" | 12 #include "sync/engine/sync_scheduler.h" |
12 #include "sync/engine/syncer.h" | 13 #include "sync/engine/syncer.h" |
13 #include "sync/sessions/test_util.h" | 14 #include "sync/sessions/test_util.h" |
14 #include "sync/test/engine/fake_model_safe_worker_registrar.h" | 15 #include "sync/test/engine/fake_model_safe_worker_registrar.h" |
15 #include "sync/test/engine/mock_connection_manager.h" | 16 #include "sync/test/engine/mock_connection_manager.h" |
16 #include "sync/test/engine/test_directory_setter_upper.h" | 17 #include "sync/test/engine/test_directory_setter_upper.h" |
17 #include "sync/test/fake_extensions_activity_monitor.h" | 18 #include "sync/test/fake_extensions_activity_monitor.h" |
18 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
20 | 21 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 routing_info[syncable::BOOKMARKS] = GROUP_UI; | 92 routing_info[syncable::BOOKMARKS] = GROUP_UI; |
92 routing_info[syncable::AUTOFILL] = GROUP_DB; | 93 routing_info[syncable::AUTOFILL] = GROUP_DB; |
93 routing_info[syncable::THEMES] = GROUP_UI; | 94 routing_info[syncable::THEMES] = GROUP_UI; |
94 routing_info[syncable::NIGORI] = GROUP_PASSIVE; | 95 routing_info[syncable::NIGORI] = GROUP_PASSIVE; |
95 registrar_.reset(new FakeModelSafeWorkerRegistrar(routing_info)); | 96 registrar_.reset(new FakeModelSafeWorkerRegistrar(routing_info)); |
96 connection_.reset(new MockConnectionManager(directory())); | 97 connection_.reset(new MockConnectionManager(directory())); |
97 connection_->SetServerReachable(); | 98 connection_->SetServerReachable(); |
98 context_ = new SyncSessionContext( | 99 context_ = new SyncSessionContext( |
99 connection_.get(), directory(), registrar_.get(), | 100 connection_.get(), directory(), registrar_.get(), |
100 &extensions_activity_monitor_, | 101 &extensions_activity_monitor_, |
| 102 &throttled_data_type_tracker_, |
101 std::vector<SyncEngineEventListener*>(), NULL, NULL); | 103 std::vector<SyncEngineEventListener*>(), NULL, NULL); |
102 context_->set_notifications_enabled(true); | 104 context_->set_notifications_enabled(true); |
103 context_->set_account_name("Test"); | 105 context_->set_account_name("Test"); |
104 scheduler_.reset( | 106 scheduler_.reset( |
105 new SyncScheduler("TestSyncScheduler", context_, syncer_)); | 107 new SyncScheduler("TestSyncScheduler", context_, syncer_)); |
106 } | 108 } |
107 | 109 |
108 SyncScheduler* scheduler() { return scheduler_.get(); } | 110 SyncScheduler* scheduler() { return scheduler_.get(); } |
109 MockSyncer* syncer() { return syncer_; } | 111 MockSyncer* syncer() { return syncer_; } |
110 MockDelayProvider* delay() { return delay_; } | 112 MockDelayProvider* delay() { return delay_; } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 base::WeakPtrFactory<SyncSchedulerTest> weak_ptr_factory_; | 197 base::WeakPtrFactory<SyncSchedulerTest> weak_ptr_factory_; |
196 MessageLoop message_loop_; | 198 MessageLoop message_loop_; |
197 TestDirectorySetterUpper dir_maker_; | 199 TestDirectorySetterUpper dir_maker_; |
198 scoped_ptr<SyncScheduler> scheduler_; | 200 scoped_ptr<SyncScheduler> scheduler_; |
199 scoped_ptr<MockConnectionManager> connection_; | 201 scoped_ptr<MockConnectionManager> connection_; |
200 SyncSessionContext* context_; | 202 SyncSessionContext* context_; |
201 MockSyncer* syncer_; | 203 MockSyncer* syncer_; |
202 MockDelayProvider* delay_; | 204 MockDelayProvider* delay_; |
203 scoped_ptr<FakeModelSafeWorkerRegistrar> registrar_; | 205 scoped_ptr<FakeModelSafeWorkerRegistrar> registrar_; |
204 FakeExtensionsActivityMonitor extensions_activity_monitor_; | 206 FakeExtensionsActivityMonitor extensions_activity_monitor_; |
| 207 ThrottledDataTypeTracker throttled_data_type_tracker_; |
205 }; | 208 }; |
206 | 209 |
207 class BackoffTriggersSyncSchedulerTest : public SyncSchedulerTest { | 210 class BackoffTriggersSyncSchedulerTest : public SyncSchedulerTest { |
208 void SetUp() { | 211 void SetUp() { |
209 SyncSchedulerTest::SetUp(); | 212 SyncSchedulerTest::SetUp(); |
210 UseMockDelayProvider(); | 213 UseMockDelayProvider(); |
211 EXPECT_CALL(*delay(), GetDelay(_)) | 214 EXPECT_CALL(*delay(), GetDelay(_)) |
212 .WillRepeatedly(Return(TimeDelta::FromMilliseconds(1))); | 215 .WillRepeatedly(Return(TimeDelta::FromMilliseconds(1))); |
213 } | 216 } |
214 | 217 |
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 PumpLoop(); | 1158 PumpLoop(); |
1156 // Pump again to run job. | 1159 // Pump again to run job. |
1157 PumpLoop(); | 1160 PumpLoop(); |
1158 | 1161 |
1159 StopSyncScheduler(); | 1162 StopSyncScheduler(); |
1160 | 1163 |
1161 EXPECT_TRUE(expected == context()->previous_session_routing_info()); | 1164 EXPECT_TRUE(expected == context()->previous_session_routing_info()); |
1162 } | 1165 } |
1163 | 1166 |
1164 } // namespace browser_sync | 1167 } // namespace browser_sync |
OLD | NEW |