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

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

Issue 135923002: Revert 244381 "Support GU retry command in sync engine. The comm..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 11 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 last_short_poll_interval_received_ = new_interval; 143 last_short_poll_interval_received_ = new_interval;
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 {}
154 virtual void OnSyncProtocolError( 153 virtual void OnSyncProtocolError(
155 const sessions::SyncSessionSnapshot& snapshot) OVERRIDE { 154 const sessions::SyncSessionSnapshot& snapshot) OVERRIDE {
156 } 155 }
157 156
158 void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) { 157 void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) {
159 // 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
160 // 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.
161 for (ModelTypeSet::Iterator it = enabled_datatypes_.First(); 160 for (ModelTypeSet::Iterator it = enabled_datatypes_.First();
162 it.Good(); it.Inc()) { 161 it.Good(); it.Inc()) {
163 (*out)[it.Get()] = GROUP_PASSIVE; 162 (*out)[it.Get()] = GROUP_PASSIVE;
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 Cryptographer* GetCryptographer(syncable::BaseTransaction* trans) { 458 Cryptographer* GetCryptographer(syncable::BaseTransaction* trans) {
460 return directory()->GetCryptographer(trans); 459 return directory()->GetCryptographer(trans);
461 } 460 }
462 461
463 // Configures SyncSessionContext and NudgeTracker so Syncer won't call 462 // Configures SyncSessionContext and NudgeTracker so Syncer won't call
464 // GetUpdates prior to Commit. This method can be used to ensure a Commit is 463 // GetUpdates prior to Commit. This method can be used to ensure a Commit is
465 // not preceeded by GetUpdates. 464 // not preceeded by GetUpdates.
466 void ConfigureNoGetUpdatesRequired() { 465 void ConfigureNoGetUpdatesRequired() {
467 context_->set_server_enabled_pre_commit_update_avoidance(true); 466 context_->set_server_enabled_pre_commit_update_avoidance(true);
468 nudge_tracker_.OnInvalidationsEnabled(); 467 nudge_tracker_.OnInvalidationsEnabled();
469 nudge_tracker_.RecordSuccessfulSyncCycle(base::TimeTicks::Now()); 468 nudge_tracker_.RecordSuccessfulSyncCycle();
470 469
471 ASSERT_FALSE(context_->ShouldFetchUpdatesBeforeCommit()); 470 ASSERT_FALSE(context_->ShouldFetchUpdatesBeforeCommit());
472 ASSERT_FALSE(nudge_tracker_.IsGetUpdatesRequired(base::TimeTicks::Now())); 471 ASSERT_FALSE(nudge_tracker_.IsGetUpdatesRequired());
473 } 472 }
474 473
475 base::MessageLoop message_loop_; 474 base::MessageLoop message_loop_;
476 475
477 // Some ids to aid tests. Only the root one's value is specific. The rest 476 // Some ids to aid tests. Only the root one's value is specific. The rest
478 // are named for test clarity. 477 // are named for test clarity.
479 // TODO(chron): Get rid of these inbuilt IDs. They only make it 478 // TODO(chron): Get rid of these inbuilt IDs. They only make it
480 // more confusing. 479 // more confusing.
481 syncable::Id root_id_; 480 syncable::Id root_id_;
482 syncable::Id parent_id_; 481 syncable::Id parent_id_;
(...skipping 4314 matching lines...) Expand 10 before | Expand all | Expand 10 after
4797 EXPECT_EQ("xyz", final_monitor_records["xyz"].extension_id); 4796 EXPECT_EQ("xyz", final_monitor_records["xyz"].extension_id);
4798 EXPECT_EQ(2049U, final_monitor_records["ABC"].bookmark_write_count); 4797 EXPECT_EQ(2049U, final_monitor_records["ABC"].bookmark_write_count);
4799 EXPECT_EQ(4U, final_monitor_records["xyz"].bookmark_write_count); 4798 EXPECT_EQ(4U, final_monitor_records["xyz"].bookmark_write_count);
4800 } else { 4799 } else {
4801 EXPECT_TRUE(final_monitor_records.empty()) 4800 EXPECT_TRUE(final_monitor_records.empty())
4802 << "Should not restore records after successful bookmark commit."; 4801 << "Should not restore records after successful bookmark commit.";
4803 } 4802 }
4804 } 4803 }
4805 4804
4806 } // namespace syncer 4805 } // namespace syncer
OLDNEW
« no previous file with comments | « trunk/src/sync/engine/syncer_proto_util.cc ('k') | trunk/src/sync/protocol/client_commands.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698