OLD | NEW |
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 Loading... |
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 OnReceivedGuRetryDelaySeconds(int delay_seconds) 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 GetWorkers(std::vector<ModelSafeWorker*>* out) { | 158 void GetWorkers(std::vector<ModelSafeWorker*>* out) { |
158 out->push_back(worker_.get()); | 159 out->push_back(worker_.get()); |
159 } | 160 } |
160 | 161 |
161 void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) { | 162 void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) { |
162 // We're just testing the sync engine here, so we shunt everything to | 163 // We're just testing the sync engine here, so we shunt everything to |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 Cryptographer* GetCryptographer(syncable::BaseTransaction* trans) { | 465 Cryptographer* GetCryptographer(syncable::BaseTransaction* trans) { |
465 return directory()->GetCryptographer(trans); | 466 return directory()->GetCryptographer(trans); |
466 } | 467 } |
467 | 468 |
468 // Configures SyncSessionContext and NudgeTracker so Syncer won't call | 469 // Configures SyncSessionContext and NudgeTracker so Syncer won't call |
469 // GetUpdates prior to Commit. This method can be used to ensure a Commit is | 470 // GetUpdates prior to Commit. This method can be used to ensure a Commit is |
470 // not preceeded by GetUpdates. | 471 // not preceeded by GetUpdates. |
471 void ConfigureNoGetUpdatesRequired() { | 472 void ConfigureNoGetUpdatesRequired() { |
472 context_->set_server_enabled_pre_commit_update_avoidance(true); | 473 context_->set_server_enabled_pre_commit_update_avoidance(true); |
473 nudge_tracker_.OnInvalidationsEnabled(); | 474 nudge_tracker_.OnInvalidationsEnabled(); |
474 nudge_tracker_.RecordSuccessfulSyncCycle(); | 475 nudge_tracker_.RecordSuccessfulSyncCycle(base::TimeTicks::Now()); |
475 | 476 |
476 ASSERT_FALSE(context_->ShouldFetchUpdatesBeforeCommit()); | 477 ASSERT_FALSE(context_->ShouldFetchUpdatesBeforeCommit()); |
477 ASSERT_FALSE(nudge_tracker_.IsGetUpdatesRequired()); | 478 ASSERT_FALSE(nudge_tracker_.IsGetUpdatesRequired(base::TimeTicks::Now())); |
478 } | 479 } |
479 | 480 |
480 base::MessageLoop message_loop_; | 481 base::MessageLoop message_loop_; |
481 | 482 |
482 // Some ids to aid tests. Only the root one's value is specific. The rest | 483 // Some ids to aid tests. Only the root one's value is specific. The rest |
483 // are named for test clarity. | 484 // are named for test clarity. |
484 // TODO(chron): Get rid of these inbuilt IDs. They only make it | 485 // TODO(chron): Get rid of these inbuilt IDs. They only make it |
485 // more confusing. | 486 // more confusing. |
486 syncable::Id root_id_; | 487 syncable::Id root_id_; |
487 syncable::Id parent_id_; | 488 syncable::Id parent_id_; |
(...skipping 4314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4802 EXPECT_EQ("xyz", final_monitor_records["xyz"].extension_id); | 4803 EXPECT_EQ("xyz", final_monitor_records["xyz"].extension_id); |
4803 EXPECT_EQ(2049U, final_monitor_records["ABC"].bookmark_write_count); | 4804 EXPECT_EQ(2049U, final_monitor_records["ABC"].bookmark_write_count); |
4804 EXPECT_EQ(4U, final_monitor_records["xyz"].bookmark_write_count); | 4805 EXPECT_EQ(4U, final_monitor_records["xyz"].bookmark_write_count); |
4805 } else { | 4806 } else { |
4806 EXPECT_TRUE(final_monitor_records.empty()) | 4807 EXPECT_TRUE(final_monitor_records.empty()) |
4807 << "Should not restore records after successful bookmark commit."; | 4808 << "Should not restore records after successful bookmark commit."; |
4808 } | 4809 } |
4809 } | 4810 } |
4810 | 4811 |
4811 } // namespace syncer | 4812 } // namespace syncer |
OLD | NEW |