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