| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 virtual void OnReceivedShortPollIntervalUpdate( | 119 virtual void OnReceivedShortPollIntervalUpdate( |
| 120 const base::TimeDelta& new_interval) OVERRIDE { | 120 const base::TimeDelta& new_interval) OVERRIDE { |
| 121 last_short_poll_interval_received_ = new_interval; | 121 last_short_poll_interval_received_ = new_interval; |
| 122 } | 122 } |
| 123 virtual void OnReceivedSessionsCommitDelay( | 123 virtual void OnReceivedSessionsCommitDelay( |
| 124 const base::TimeDelta& new_delay) OVERRIDE { | 124 const base::TimeDelta& new_delay) OVERRIDE { |
| 125 last_sessions_commit_delay_seconds_ = new_delay; | 125 last_sessions_commit_delay_seconds_ = new_delay; |
| 126 } | 126 } |
| 127 virtual void OnShouldStopSyncingPermanently() OVERRIDE { | 127 virtual void OnShouldStopSyncingPermanently() OVERRIDE { |
| 128 } | 128 } |
| 129 virtual void OnSyncProtocolError( |
| 130 const sessions::SyncSessionSnapshot& snapshot) OVERRIDE { |
| 131 } |
| 129 | 132 |
| 130 // ModelSafeWorkerRegistrar implementation. | 133 // ModelSafeWorkerRegistrar implementation. |
| 131 virtual void GetWorkers(std::vector<ModelSafeWorker*>* out) OVERRIDE { | 134 virtual void GetWorkers(std::vector<ModelSafeWorker*>* out) OVERRIDE { |
| 132 out->push_back(worker_.get()); | 135 out->push_back(worker_.get()); |
| 133 } | 136 } |
| 134 | 137 |
| 135 virtual void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) OVERRIDE { | 138 virtual void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) OVERRIDE { |
| 136 // We're just testing the sync engine here, so we shunt everything to | 139 // We're just testing the sync engine here, so we shunt everything to |
| 137 // the SyncerThread. Datatypes which aren't enabled aren't in the map. | 140 // the SyncerThread. Datatypes which aren't enabled aren't in the map. |
| 138 for (int i = 0; i < syncable::MODEL_TYPE_COUNT; ++i) { | 141 for (int i = 0; i < syncable::MODEL_TYPE_COUNT; ++i) { |
| (...skipping 1994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2133 ASSERT_TRUE(existing.good()); | 2136 ASSERT_TRUE(existing.good()); |
| 2134 existing.Put(PARENT_ID, newfolder.Get(ID)); | 2137 existing.Put(PARENT_ID, newfolder.Get(ID)); |
| 2135 existing.Put(IS_UNSYNCED, true); | 2138 existing.Put(IS_UNSYNCED, true); |
| 2136 EXPECT_TRUE(existing.Get(ID).ServerKnows()); | 2139 EXPECT_TRUE(existing.Get(ID).ServerKnows()); |
| 2137 | 2140 |
| 2138 newfolder.Put(IS_DEL, true); | 2141 newfolder.Put(IS_DEL, true); |
| 2139 existing.Put(IS_DEL, true); | 2142 existing.Put(IS_DEL, true); |
| 2140 } | 2143 } |
| 2141 syncer_->SyncShare(session_.get(), SYNCER_BEGIN, SYNCER_END); | 2144 syncer_->SyncShare(session_.get(), SYNCER_BEGIN, SYNCER_END); |
| 2142 StatusController* status(session_->status_controller()); | 2145 StatusController* status(session_->status_controller()); |
| 2143 EXPECT_TRUE(0 == status->error_counters().num_conflicting_commits); | 2146 EXPECT_TRUE(0 == status->error().num_conflicting_commits); |
| 2144 } | 2147 } |
| 2145 | 2148 |
| 2146 TEST_F(SyncerTest, DeletingEntryWithLocalEdits) { | 2149 TEST_F(SyncerTest, DeletingEntryWithLocalEdits) { |
| 2147 ScopedDirLookup dir(syncdb_.manager(), syncdb_.name()); | 2150 ScopedDirLookup dir(syncdb_.manager(), syncdb_.name()); |
| 2148 CHECK(dir.good()); | 2151 CHECK(dir.good()); |
| 2149 int64 newfolder_metahandle; | 2152 int64 newfolder_metahandle; |
| 2150 | 2153 |
| 2151 mock_server_->AddUpdateDirectory(1, 0, "bob", 1, 10); | 2154 mock_server_->AddUpdateDirectory(1, 0, "bob", 1, 10); |
| 2152 SyncShareAsDelegate(); | 2155 SyncShareAsDelegate(); |
| 2153 { | 2156 { |
| (...skipping 3083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5237 Add(low_id_); | 5240 Add(low_id_); |
| 5238 Add(high_id_); | 5241 Add(high_id_); |
| 5239 SyncShareAsDelegate(); | 5242 SyncShareAsDelegate(); |
| 5240 ExpectLocalOrderIsByServerId(); | 5243 ExpectLocalOrderIsByServerId(); |
| 5241 } | 5244 } |
| 5242 | 5245 |
| 5243 const SyncerTest::CommitOrderingTest | 5246 const SyncerTest::CommitOrderingTest |
| 5244 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()}; | 5247 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()}; |
| 5245 | 5248 |
| 5246 } // namespace browser_sync | 5249 } // namespace browser_sync |
| OLD | NEW |