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

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

Issue 13743003: sync: Finish the SyncScheduler refactor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix AuthErrorTest Created 7 years, 8 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
« no previous file with comments | « sync/engine/sync_session_job_unittest.cc ('k') | sync/sessions/nudge_tracker.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 // Syncer unit tests. Unfortunately a lot of these tests 5 // Syncer unit tests. Unfortunately a lot of these tests
6 // are outdated and need to be reworked and updated. 6 // are outdated and need to be reworked and updated.
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <limits> 9 #include <limits>
10 #include <list> 10 #include <list>
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 SyncSession* MakeSession() { 174 SyncSession* MakeSession() {
175 ModelSafeRoutingInfo info; 175 ModelSafeRoutingInfo info;
176 GetModelSafeRoutingInfo(&info); 176 GetModelSafeRoutingInfo(&info);
177 ModelTypeInvalidationMap invalidation_map = 177 ModelTypeInvalidationMap invalidation_map =
178 ModelSafeRoutingInfoToInvalidationMap(info, std::string()); 178 ModelSafeRoutingInfoToInvalidationMap(info, std::string());
179 sessions::SyncSourceInfo source_info(sync_pb::GetUpdatesCallerInfo::UNKNOWN, 179 sessions::SyncSourceInfo source_info(sync_pb::GetUpdatesCallerInfo::UNKNOWN,
180 invalidation_map); 180 invalidation_map);
181 return new SyncSession(context_.get(), this, source_info); 181 return new SyncSession(context_.get(), this, source_info);
182 } 182 }
183 183
184
185 void SyncShareAsDelegate(SyncSessionJob::Purpose purpose) {
186 SyncerStep start;
187 SyncerStep end;
188 SyncSessionJob::GetSyncerStepsForPurpose(purpose, &start, &end);
189
190 session_.reset(MakeSession());
191 EXPECT_TRUE(syncer_->SyncShare(session_.get(), start, end));
192 }
193
194 void SyncShareNudge() { 184 void SyncShareNudge() {
195 session_.reset(MakeSession()); 185 session_.reset(MakeSession());
196 SyncShareAsDelegate(SyncSessionJob::NUDGE); 186 EXPECT_TRUE(syncer_->SyncShare(session_.get(), SYNCER_BEGIN, SYNCER_END));
197 } 187 }
198 188
199 void SyncShareConfigure() { 189 void SyncShareConfigure() {
200 session_.reset(MakeSession()); 190 session_.reset(MakeSession());
201 SyncShareAsDelegate(SyncSessionJob::CONFIGURATION); 191 EXPECT_TRUE(
192 syncer_->SyncShare(session_.get(), DOWNLOAD_UPDATES, APPLY_UPDATES));
202 } 193 }
203 194
204 virtual void SetUp() { 195 virtual void SetUp() {
205 dir_maker_.SetUp(); 196 dir_maker_.SetUp();
206 mock_server_.reset(new MockConnectionManager(directory())); 197 mock_server_.reset(new MockConnectionManager(directory()));
207 EnableDatatype(BOOKMARKS); 198 EnableDatatype(BOOKMARKS);
208 EnableDatatype(NIGORI); 199 EnableDatatype(NIGORI);
209 EnableDatatype(PREFERENCES); 200 EnableDatatype(PREFERENCES);
210 EnableDatatype(NIGORI); 201 EnableDatatype(NIGORI);
211 worker_ = new FakeModelWorker(GROUP_PASSIVE); 202 worker_ = new FakeModelWorker(GROUP_PASSIVE);
(...skipping 4589 matching lines...) Expand 10 before | Expand all | Expand 10 after
4801 EXPECT_EQ("xyz", final_monitor_records["xyz"].extension_id); 4792 EXPECT_EQ("xyz", final_monitor_records["xyz"].extension_id);
4802 EXPECT_EQ(2049U, final_monitor_records["ABC"].bookmark_write_count); 4793 EXPECT_EQ(2049U, final_monitor_records["ABC"].bookmark_write_count);
4803 EXPECT_EQ(4U, final_monitor_records["xyz"].bookmark_write_count); 4794 EXPECT_EQ(4U, final_monitor_records["xyz"].bookmark_write_count);
4804 } else { 4795 } else {
4805 EXPECT_TRUE(final_monitor_records.empty()) 4796 EXPECT_TRUE(final_monitor_records.empty())
4806 << "Should not restore records after successful bookmark commit."; 4797 << "Should not restore records after successful bookmark commit.";
4807 } 4798 }
4808 } 4799 }
4809 4800
4810 } // namespace syncer 4801 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/sync_session_job_unittest.cc ('k') | sync/sessions/nudge_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698