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/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "base/time.h" | 6 #include "base/time.h" |
7 #include "sync/engine/sync_scheduler.h" | 7 #include "sync/engine/sync_scheduler.h" |
8 #include "sync/engine/throttled_data_type_tracker.h" | 8 #include "sync/engine/throttled_data_type_tracker.h" |
9 #include "sync/sessions/sync_session_context.h" | 9 #include "sync/sessions/sync_session_context.h" |
10 #include "sync/sessions/test_util.h" | 10 #include "sync/sessions/test_util.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 ResetWaitInterval(); | 100 ResetWaitInterval(); |
101 SetLastSyncedTime(base::TimeTicks::Now()); | 101 SetLastSyncedTime(base::TimeTicks::Now()); |
102 } | 102 } |
103 | 103 |
104 SyncScheduler::JobProcessDecision CreateAndDecideJob( | 104 SyncScheduler::JobProcessDecision CreateAndDecideJob( |
105 SyncScheduler::SyncSessionJob::SyncSessionJobPurpose purpose) { | 105 SyncScheduler::SyncSessionJob::SyncSessionJobPurpose purpose) { |
106 SyncSession* s = scheduler_->CreateSyncSession(SyncSourceInfo()); | 106 SyncSession* s = scheduler_->CreateSyncSession(SyncSourceInfo()); |
107 SyncScheduler::SyncSessionJob job(purpose, TimeTicks::Now(), | 107 SyncScheduler::SyncSessionJob job(purpose, TimeTicks::Now(), |
108 make_linked_ptr(s), | 108 make_linked_ptr(s), |
109 false, | 109 false, |
| 110 ConfigurationParams(), |
110 FROM_HERE); | 111 FROM_HERE); |
111 return DecideOnJob(job); | 112 return DecideOnJob(job); |
112 } | 113 } |
113 | 114 |
114 SyncSessionContext* context() { return context_.get(); } | 115 SyncSessionContext* context() { return context_.get(); } |
115 | 116 |
116 private: | 117 private: |
117 MessageLoop message_loop_; | 118 MessageLoop message_loop_; |
118 scoped_ptr<MockConnectionManager> connection_; | 119 scoped_ptr<MockConnectionManager> connection_; |
119 scoped_ptr<SyncSessionContext> context_; | 120 scoped_ptr<SyncSessionContext> context_; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 types_with_payload[syncer::BOOKMARKS] = ""; | 154 types_with_payload[syncer::BOOKMARKS] = ""; |
154 | 155 |
155 SyncSourceInfo info(GetUpdatesCallerInfo::LOCAL, types_with_payload); | 156 SyncSourceInfo info(GetUpdatesCallerInfo::LOCAL, types_with_payload); |
156 SyncSession* s = scheduler_->CreateSyncSession(info); | 157 SyncSession* s = scheduler_->CreateSyncSession(info); |
157 | 158 |
158 // Now schedule a nudge with just bookmarks and the change is local. | 159 // Now schedule a nudge with just bookmarks and the change is local. |
159 SyncScheduler::SyncSessionJob job(SyncScheduler::SyncSessionJob::NUDGE, | 160 SyncScheduler::SyncSessionJob job(SyncScheduler::SyncSessionJob::NUDGE, |
160 TimeTicks::Now(), | 161 TimeTicks::Now(), |
161 make_linked_ptr(s), | 162 make_linked_ptr(s), |
162 false, | 163 false, |
| 164 ConfigurationParams(), |
163 FROM_HERE); | 165 FROM_HERE); |
164 | 166 |
165 SyncScheduler::JobProcessDecision decision = DecideOnJob(job); | 167 SyncScheduler::JobProcessDecision decision = DecideOnJob(job); |
166 EXPECT_EQ(decision, SyncScheduler::SAVE); | 168 EXPECT_EQ(decision, SyncScheduler::SAVE); |
167 } | 169 } |
168 | 170 |
169 TEST_F(SyncSchedulerWhiteboxTest, ContinueNudge) { | 171 TEST_F(SyncSchedulerWhiteboxTest, ContinueNudge) { |
170 InitializeSyncerOnNormalMode(); | 172 InitializeSyncerOnNormalMode(); |
171 | 173 |
172 SyncScheduler::JobProcessDecision decision = CreateAndDecideJob( | 174 SyncScheduler::JobProcessDecision decision = CreateAndDecideJob( |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 struct SyncScheduler::SyncSessionJob job; | 261 struct SyncScheduler::SyncSessionJob job; |
260 job.purpose = SyncScheduler::SyncSessionJob::CONFIGURATION; | 262 job.purpose = SyncScheduler::SyncSessionJob::CONFIGURATION; |
261 job.scheduled_start = TimeTicks::Now(); | 263 job.scheduled_start = TimeTicks::Now(); |
262 job.is_canary_job = true; | 264 job.is_canary_job = true; |
263 SyncScheduler::JobProcessDecision decision = DecideOnJob(job); | 265 SyncScheduler::JobProcessDecision decision = DecideOnJob(job); |
264 | 266 |
265 EXPECT_EQ(decision, SyncScheduler::CONTINUE); | 267 EXPECT_EQ(decision, SyncScheduler::CONTINUE); |
266 } | 268 } |
267 | 269 |
268 } // namespace syncer | 270 } // namespace syncer |
OLD | NEW |