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

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

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

Powered by Google App Engine
This is Rietveld 408576698