| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 SyncSession* MakeSession() { | 174 SyncSession* MakeSession() { |
| 175 ModelSafeRoutingInfo info; | 175 ModelSafeRoutingInfo info; |
| 176 GetModelSafeRoutingInfo(&info); | 176 GetModelSafeRoutingInfo(&info); |
| 177 ModelTypeInvalidationMap invalidation_map = | 177 ModelTypeInvalidationMap invalidation_map = |
| 178 ModelSafeRoutingInfoToInvalidationMap(info, std::string()); | 178 ModelSafeRoutingInfoToInvalidationMap(info, std::string()); |
| 179 sessions::SyncSourceInfo source_info(sync_pb::GetUpdatesCallerInfo::UNKNOWN, | 179 sessions::SyncSourceInfo source_info(sync_pb::GetUpdatesCallerInfo::UNKNOWN, |
| 180 invalidation_map); | 180 invalidation_map); |
| 181 return new SyncSession(context_.get(), this, source_info); | 181 return new SyncSession(context_.get(), this, source_info); |
| 182 } | 182 } |
| 183 | 183 |
| 184 | |
| 185 void SyncShareAsDelegate(SyncSessionJob::Purpose purpose) { | |
| 186 SyncerStep start; | |
| 187 SyncerStep end; | |
| 188 SyncSessionJob::GetSyncerStepsForPurpose(purpose, &start, &end); | |
| 189 | |
| 190 session_.reset(MakeSession()); | |
| 191 EXPECT_TRUE(syncer_->SyncShare(session_.get(), start, end)); | |
| 192 } | |
| 193 | |
| 194 void SyncShareNudge() { | 184 void SyncShareNudge() { |
| 195 session_.reset(MakeSession()); | 185 session_.reset(MakeSession()); |
| 196 SyncShareAsDelegate(SyncSessionJob::NUDGE); | 186 EXPECT_TRUE(syncer_->SyncShare(session_.get(), SYNCER_BEGIN, SYNCER_END)); |
| 197 } | 187 } |
| 198 | 188 |
| 199 void SyncShareConfigure() { | 189 void SyncShareConfigure() { |
| 200 session_.reset(MakeSession()); | 190 session_.reset(MakeSession()); |
| 201 SyncShareAsDelegate(SyncSessionJob::CONFIGURATION); | 191 EXPECT_TRUE( |
| 192 syncer_->SyncShare(session_.get(), DOWNLOAD_UPDATES, APPLY_UPDATES)); |
| 202 } | 193 } |
| 203 | 194 |
| 204 virtual void SetUp() { | 195 virtual void SetUp() { |
| 205 dir_maker_.SetUp(); | 196 dir_maker_.SetUp(); |
| 206 mock_server_.reset(new MockConnectionManager(directory())); | 197 mock_server_.reset(new MockConnectionManager(directory())); |
| 207 EnableDatatype(BOOKMARKS); | 198 EnableDatatype(BOOKMARKS); |
| 208 EnableDatatype(NIGORI); | 199 EnableDatatype(NIGORI); |
| 209 EnableDatatype(PREFERENCES); | 200 EnableDatatype(PREFERENCES); |
| 210 EnableDatatype(NIGORI); | 201 EnableDatatype(NIGORI); |
| 211 worker_ = new FakeModelWorker(GROUP_PASSIVE); | 202 worker_ = new FakeModelWorker(GROUP_PASSIVE); |
| (...skipping 4589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4801 EXPECT_EQ("xyz", final_monitor_records["xyz"].extension_id); | 4792 EXPECT_EQ("xyz", final_monitor_records["xyz"].extension_id); |
| 4802 EXPECT_EQ(2049U, final_monitor_records["ABC"].bookmark_write_count); | 4793 EXPECT_EQ(2049U, final_monitor_records["ABC"].bookmark_write_count); |
| 4803 EXPECT_EQ(4U, final_monitor_records["xyz"].bookmark_write_count); | 4794 EXPECT_EQ(4U, final_monitor_records["xyz"].bookmark_write_count); |
| 4804 } else { | 4795 } else { |
| 4805 EXPECT_TRUE(final_monitor_records.empty()) | 4796 EXPECT_TRUE(final_monitor_records.empty()) |
| 4806 << "Should not restore records after successful bookmark commit."; | 4797 << "Should not restore records after successful bookmark commit."; |
| 4807 } | 4798 } |
| 4808 } | 4799 } |
| 4809 | 4800 |
| 4810 } // namespace syncer | 4801 } // namespace syncer |
| OLD | NEW |