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

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

Issue 158953004: sync: Move migration signal out of snapshot (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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
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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 144 }
145 virtual void OnReceivedSessionsCommitDelay( 145 virtual void OnReceivedSessionsCommitDelay(
146 const base::TimeDelta& new_delay) OVERRIDE { 146 const base::TimeDelta& new_delay) OVERRIDE {
147 last_sessions_commit_delay_seconds_ = new_delay; 147 last_sessions_commit_delay_seconds_ = new_delay;
148 } 148 }
149 virtual void OnReceivedClientInvalidationHintBufferSize( 149 virtual void OnReceivedClientInvalidationHintBufferSize(
150 int size) OVERRIDE { 150 int size) OVERRIDE {
151 last_client_invalidation_hint_buffer_size_ = size; 151 last_client_invalidation_hint_buffer_size_ = size;
152 } 152 }
153 virtual void OnReceivedGuRetryDelay(const base::TimeDelta& delay) OVERRIDE {} 153 virtual void OnReceivedGuRetryDelay(const base::TimeDelta& delay) OVERRIDE {}
154 virtual void OnReceivedMigrationRequest(ModelTypeSet types) OVERRIDE {}
154 virtual void OnSyncProtocolError(const SyncProtocolError& error) OVERRIDE {} 155 virtual void OnSyncProtocolError(const SyncProtocolError& error) OVERRIDE {}
155 156
156 void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) { 157 void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) {
157 // We're just testing the sync engine here, so we shunt everything to 158 // We're just testing the sync engine here, so we shunt everything to
158 // the SyncerThread. Datatypes which aren't enabled aren't in the map. 159 // the SyncerThread. Datatypes which aren't enabled aren't in the map.
159 for (ModelTypeSet::Iterator it = enabled_datatypes_.First(); 160 for (ModelTypeSet::Iterator it = enabled_datatypes_.First();
160 it.Good(); it.Inc()) { 161 it.Good(); it.Inc()) {
161 (*out)[it.Get()] = GROUP_PASSIVE; 162 (*out)[it.Get()] = GROUP_PASSIVE;
162 } 163 }
163 } 164 }
164 165
165 virtual void OnSyncCycleEvent(const SyncCycleEvent& event) OVERRIDE { 166 virtual void OnSyncCycleEvent(const SyncCycleEvent& event) OVERRIDE {
166 DVLOG(1) << "HandleSyncEngineEvent in unittest " << event.what_happened; 167 DVLOG(1) << "HandleSyncEngineEvent in unittest " << event.what_happened;
167 // we only test for entry-specific events, not status changed ones. 168 // we only test for entry-specific events, not status changed ones.
168 switch (event.what_happened) { 169 switch (event.what_happened) {
169 case SyncCycleEvent::SYNC_CYCLE_BEGIN: // Fall through. 170 case SyncCycleEvent::SYNC_CYCLE_BEGIN: // Fall through.
170 case SyncCycleEvent::STATUS_CHANGED: 171 case SyncCycleEvent::STATUS_CHANGED:
171 case SyncCycleEvent::SYNC_CYCLE_ENDED: 172 case SyncCycleEvent::SYNC_CYCLE_ENDED:
172 return; 173 return;
173 default: 174 default:
174 CHECK(false) << "Handling unknown error type in unit tests!!"; 175 CHECK(false) << "Handling unknown error type in unit tests!!";
175 } 176 }
176 saw_syncer_event_ = true; 177 saw_syncer_event_ = true;
177 } 178 }
178 179
179 virtual void OnActionableError(const SyncProtocolError& error) OVERRIDE {} 180 virtual void OnActionableError(const SyncProtocolError& error) OVERRIDE {}
180 virtual void OnRetryTimeChanged(base::Time retry_time) OVERRIDE {} 181 virtual void OnRetryTimeChanged(base::Time retry_time) OVERRIDE {}
181 virtual void OnThrottledTypesChanged(ModelTypeSet throttled_types) OVERRIDE {} 182 virtual void OnThrottledTypesChanged(ModelTypeSet throttled_types) OVERRIDE {}
183 virtual void OnMigrationRequested(ModelTypeSet types) OVERRIDE {}
182 184
183 void ResetSession() { 185 void ResetSession() {
184 session_.reset(SyncSession::Build(context_.get(), this)); 186 session_.reset(SyncSession::Build(context_.get(), this));
185 } 187 }
186 188
187 void SyncShareNudge() { 189 void SyncShareNudge() {
188 ResetSession(); 190 ResetSession();
189 191
190 // Pretend we've seen a local change, to make the nudge_tracker look normal. 192 // Pretend we've seen a local change, to make the nudge_tracker look normal.
191 nudge_tracker_.RecordLocalChange(ModelTypeSet(BOOKMARKS)); 193 nudge_tracker_.RecordLocalChange(ModelTypeSet(BOOKMARKS));
(...skipping 4611 matching lines...) Expand 10 before | Expand all | Expand 10 after
4803 EXPECT_EQ("xyz", final_monitor_records["xyz"].extension_id); 4805 EXPECT_EQ("xyz", final_monitor_records["xyz"].extension_id);
4804 EXPECT_EQ(2049U, final_monitor_records["ABC"].bookmark_write_count); 4806 EXPECT_EQ(2049U, final_monitor_records["ABC"].bookmark_write_count);
4805 EXPECT_EQ(4U, final_monitor_records["xyz"].bookmark_write_count); 4807 EXPECT_EQ(4U, final_monitor_records["xyz"].bookmark_write_count);
4806 } else { 4808 } else {
4807 EXPECT_TRUE(final_monitor_records.empty()) 4809 EXPECT_TRUE(final_monitor_records.empty())
4808 << "Should not restore records after successful bookmark commit."; 4810 << "Should not restore records after successful bookmark commit.";
4809 } 4811 }
4810 } 4812 }
4811 4813
4812 } // namespace syncer 4814 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698