Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Side by Side Diff: sync/engine/sync_scheduler_whitebox_unittest.cc

Issue 10689185: Revert 146262 - Revert "Revert 142517 - [Sync] Refactor sync configuration logic." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/engine/sync_scheduler_unittest.cc ('k') | sync/internal_api/public/sync_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(),
111 FROM_HERE); 110 FROM_HERE);
112 return DecideOnJob(job); 111 return DecideOnJob(job);
113 } 112 }
114 113
115 SyncSessionContext* context() { return context_.get(); } 114 SyncSessionContext* context() { return context_.get(); }
116 115
117 private: 116 private:
118 MessageLoop message_loop_; 117 MessageLoop message_loop_;
119 scoped_ptr<MockConnectionManager> connection_; 118 scoped_ptr<MockConnectionManager> connection_;
120 scoped_ptr<SyncSessionContext> context_; 119 scoped_ptr<SyncSessionContext> context_;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 types_with_payload[syncer::BOOKMARKS] = ""; 153 types_with_payload[syncer::BOOKMARKS] = "";
155 154
156 SyncSourceInfo info(GetUpdatesCallerInfo::LOCAL, types_with_payload); 155 SyncSourceInfo info(GetUpdatesCallerInfo::LOCAL, types_with_payload);
157 SyncSession* s = scheduler_->CreateSyncSession(info); 156 SyncSession* s = scheduler_->CreateSyncSession(info);
158 157
159 // Now schedule a nudge with just bookmarks and the change is local. 158 // Now schedule a nudge with just bookmarks and the change is local.
160 SyncScheduler::SyncSessionJob job(SyncScheduler::SyncSessionJob::NUDGE, 159 SyncScheduler::SyncSessionJob job(SyncScheduler::SyncSessionJob::NUDGE,
161 TimeTicks::Now(), 160 TimeTicks::Now(),
162 make_linked_ptr(s), 161 make_linked_ptr(s),
163 false, 162 false,
164 ConfigurationParams(),
165 FROM_HERE); 163 FROM_HERE);
166 164
167 SyncScheduler::JobProcessDecision decision = DecideOnJob(job); 165 SyncScheduler::JobProcessDecision decision = DecideOnJob(job);
168 EXPECT_EQ(decision, SyncScheduler::SAVE); 166 EXPECT_EQ(decision, SyncScheduler::SAVE);
169 } 167 }
170 168
171 TEST_F(SyncSchedulerWhiteboxTest, ContinueNudge) { 169 TEST_F(SyncSchedulerWhiteboxTest, ContinueNudge) {
172 InitializeSyncerOnNormalMode(); 170 InitializeSyncerOnNormalMode();
173 171
174 SyncScheduler::JobProcessDecision decision = CreateAndDecideJob( 172 SyncScheduler::JobProcessDecision decision = CreateAndDecideJob(
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 struct SyncScheduler::SyncSessionJob job; 259 struct SyncScheduler::SyncSessionJob job;
262 job.purpose = SyncScheduler::SyncSessionJob::CONFIGURATION; 260 job.purpose = SyncScheduler::SyncSessionJob::CONFIGURATION;
263 job.scheduled_start = TimeTicks::Now(); 261 job.scheduled_start = TimeTicks::Now();
264 job.is_canary_job = true; 262 job.is_canary_job = true;
265 SyncScheduler::JobProcessDecision decision = DecideOnJob(job); 263 SyncScheduler::JobProcessDecision decision = DecideOnJob(job);
266 264
267 EXPECT_EQ(decision, SyncScheduler::CONTINUE); 265 EXPECT_EQ(decision, SyncScheduler::CONTINUE);
268 } 266 }
269 267
270 } // namespace syncer 268 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/sync_scheduler_unittest.cc ('k') | sync/internal_api/public/sync_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698