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

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

Issue 10696087: [Sync] Move ModelType and related classes to 'syncer' namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort headers, update copyrights 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/engine/syncer_proto_util.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 14 matching lines...) Expand all
25 using sessions::SyncSourceInfo; 25 using sessions::SyncSourceInfo;
26 using sync_pb::GetUpdatesCallerInfo; 26 using sync_pb::GetUpdatesCallerInfo;
27 27
28 class SyncSchedulerWhiteboxTest : public testing::Test { 28 class SyncSchedulerWhiteboxTest : public testing::Test {
29 public: 29 public:
30 virtual void SetUp() { 30 virtual void SetUp() {
31 dir_maker_.SetUp(); 31 dir_maker_.SetUp();
32 Syncer* syncer = new Syncer(); 32 Syncer* syncer = new Syncer();
33 33
34 ModelSafeRoutingInfo routes; 34 ModelSafeRoutingInfo routes;
35 routes[syncable::BOOKMARKS] = GROUP_UI; 35 routes[syncer::BOOKMARKS] = GROUP_UI;
36 routes[syncable::NIGORI] = GROUP_PASSIVE; 36 routes[syncer::NIGORI] = GROUP_PASSIVE;
37 37
38 workers_.push_back(make_scoped_refptr(new FakeModelWorker(GROUP_UI))); 38 workers_.push_back(make_scoped_refptr(new FakeModelWorker(GROUP_UI)));
39 workers_.push_back(make_scoped_refptr(new FakeModelWorker(GROUP_PASSIVE))); 39 workers_.push_back(make_scoped_refptr(new FakeModelWorker(GROUP_PASSIVE)));
40 40
41 std::vector<ModelSafeWorker*> workers; 41 std::vector<ModelSafeWorker*> workers;
42 for (std::vector<scoped_refptr<FakeModelWorker> >::iterator it = 42 for (std::vector<scoped_refptr<FakeModelWorker> >::iterator it =
43 workers_.begin(); it != workers_.end(); ++it) { 43 workers_.begin(); it != workers_.end(); ++it) {
44 workers.push_back(it->get()); 44 workers.push_back(it->get());
45 } 45 }
46 46
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 SyncScheduler::JobProcessDecision decision = 136 SyncScheduler::JobProcessDecision decision =
137 CreateAndDecideJob(SyncScheduler::SyncSessionJob::NUDGE); 137 CreateAndDecideJob(SyncScheduler::SyncSessionJob::NUDGE);
138 138
139 EXPECT_EQ(decision, SyncScheduler::SAVE); 139 EXPECT_EQ(decision, SyncScheduler::SAVE);
140 } 140 }
141 141
142 TEST_F(SyncSchedulerWhiteboxTest, SaveNudgeWhileTypeThrottled) { 142 TEST_F(SyncSchedulerWhiteboxTest, SaveNudgeWhileTypeThrottled) {
143 InitializeSyncerOnNormalMode(); 143 InitializeSyncerOnNormalMode();
144 144
145 syncable::ModelTypeSet types; 145 syncer::ModelTypeSet types;
146 types.Put(syncable::BOOKMARKS); 146 types.Put(syncer::BOOKMARKS);
147 147
148 // Mark bookmarks as throttled. 148 // Mark bookmarks as throttled.
149 context()->throttled_data_type_tracker()->SetUnthrottleTime( 149 context()->throttled_data_type_tracker()->SetUnthrottleTime(
150 types, base::TimeTicks::Now() + base::TimeDelta::FromHours(2)); 150 types, base::TimeTicks::Now() + base::TimeDelta::FromHours(2));
151 151
152 syncable::ModelTypePayloadMap types_with_payload; 152 syncer::ModelTypePayloadMap types_with_payload;
153 types_with_payload[syncable::BOOKMARKS] = ""; 153 types_with_payload[syncer::BOOKMARKS] = "";
154 154
155 SyncSourceInfo info(GetUpdatesCallerInfo::LOCAL, types_with_payload); 155 SyncSourceInfo info(GetUpdatesCallerInfo::LOCAL, types_with_payload);
156 SyncSession* s = scheduler_->CreateSyncSession(info); 156 SyncSession* s = scheduler_->CreateSyncSession(info);
157 157
158 // 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.
159 SyncScheduler::SyncSessionJob job(SyncScheduler::SyncSessionJob::NUDGE, 159 SyncScheduler::SyncSessionJob job(SyncScheduler::SyncSessionJob::NUDGE,
160 TimeTicks::Now(), 160 TimeTicks::Now(),
161 make_linked_ptr(s), 161 make_linked_ptr(s),
162 false, 162 false,
163 FROM_HERE); 163 FROM_HERE);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 struct SyncScheduler::SyncSessionJob job; 259 struct SyncScheduler::SyncSessionJob job;
260 job.purpose = SyncScheduler::SyncSessionJob::CONFIGURATION; 260 job.purpose = SyncScheduler::SyncSessionJob::CONFIGURATION;
261 job.scheduled_start = TimeTicks::Now(); 261 job.scheduled_start = TimeTicks::Now();
262 job.is_canary_job = true; 262 job.is_canary_job = true;
263 SyncScheduler::JobProcessDecision decision = DecideOnJob(job); 263 SyncScheduler::JobProcessDecision decision = DecideOnJob(job);
264 264
265 EXPECT_EQ(decision, SyncScheduler::CONTINUE); 265 EXPECT_EQ(decision, SyncScheduler::CONTINUE);
266 } 266 }
267 267
268 } // namespace syncer 268 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/sync_scheduler_unittest.cc ('k') | sync/engine/syncer_proto_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698