Chromium Code Reviews| 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 "components/sync/engine_impl/syncer.h" | 8 #include "components/sync/engine_impl/syncer.h" |
| 9 | 9 |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 #include "base/strings/string_number_conversions.h" | 28 #include "base/strings/string_number_conversions.h" |
| 29 #include "base/test/histogram_tester.h" | 29 #include "base/test/histogram_tester.h" |
| 30 #include "base/time/time.h" | 30 #include "base/time/time.h" |
| 31 #include "build/build_config.h" | 31 #include "build/build_config.h" |
| 32 #include "components/sync/base/cancelation_signal.h" | 32 #include "components/sync/base/cancelation_signal.h" |
| 33 #include "components/sync/base/cryptographer.h" | 33 #include "components/sync/base/cryptographer.h" |
| 34 #include "components/sync/base/extensions_activity.h" | 34 #include "components/sync/base/extensions_activity.h" |
| 35 #include "components/sync/base/fake_encryptor.h" | 35 #include "components/sync/base/fake_encryptor.h" |
| 36 #include "components/sync/base/model_type.h" | 36 #include "components/sync/base/model_type.h" |
| 37 #include "components/sync/base/time.h" | 37 #include "components/sync/base/time.h" |
| 38 #include "components/sync/engine/cycle/commit_counters.h" | |
| 39 #include "components/sync/engine/cycle/status_counters.h" | |
| 40 #include "components/sync/engine/cycle/update_counters.h" | |
| 38 #include "components/sync/engine/model_safe_worker.h" | 41 #include "components/sync/engine/model_safe_worker.h" |
| 39 #include "components/sync/engine_impl/backoff_delay_provider.h" | 42 #include "components/sync/engine_impl/backoff_delay_provider.h" |
| 43 #include "components/sync/engine_impl/cycle/mock_debug_info_getter.h" | |
| 44 #include "components/sync/engine_impl/cycle/sync_cycle_context.h" | |
| 40 #include "components/sync/engine_impl/get_commit_ids.h" | 45 #include "components/sync/engine_impl/get_commit_ids.h" |
| 41 #include "components/sync/engine_impl/net/server_connection_manager.h" | 46 #include "components/sync/engine_impl/net/server_connection_manager.h" |
| 42 #include "components/sync/engine_impl/sync_scheduler_impl.h" | 47 #include "components/sync/engine_impl/sync_scheduler_impl.h" |
| 43 #include "components/sync/engine_impl/syncer_proto_util.h" | 48 #include "components/sync/engine_impl/syncer_proto_util.h" |
| 44 #include "components/sync/protocol/bookmark_specifics.pb.h" | 49 #include "components/sync/protocol/bookmark_specifics.pb.h" |
| 45 #include "components/sync/protocol/nigori_specifics.pb.h" | 50 #include "components/sync/protocol/nigori_specifics.pb.h" |
| 46 #include "components/sync/protocol/preference_specifics.pb.h" | 51 #include "components/sync/protocol/preference_specifics.pb.h" |
| 47 #include "components/sync/protocol/sync.pb.h" | 52 #include "components/sync/protocol/sync.pb.h" |
| 48 #include "components/sync/sessions/commit_counters.h" | |
| 49 #include "components/sync/sessions/status_counters.h" | |
| 50 #include "components/sync/sessions/update_counters.h" | |
| 51 #include "components/sync/sessions_impl/sync_session_context.h" | |
| 52 #include "components/sync/syncable/mutable_entry.h" | 53 #include "components/sync/syncable/mutable_entry.h" |
| 53 #include "components/sync/syncable/nigori_util.h" | 54 #include "components/sync/syncable/nigori_util.h" |
| 54 #include "components/sync/syncable/syncable_delete_journal.h" | 55 #include "components/sync/syncable/syncable_delete_journal.h" |
| 55 #include "components/sync/syncable/syncable_read_transaction.h" | 56 #include "components/sync/syncable/syncable_read_transaction.h" |
| 56 #include "components/sync/syncable/syncable_util.h" | 57 #include "components/sync/syncable/syncable_util.h" |
| 57 #include "components/sync/syncable/syncable_write_transaction.h" | 58 #include "components/sync/syncable/syncable_write_transaction.h" |
| 58 #include "components/sync/test/engine/fake_model_worker.h" | 59 #include "components/sync/test/engine/fake_model_worker.h" |
| 59 #include "components/sync/test/engine/mock_connection_manager.h" | 60 #include "components/sync/test/engine/mock_connection_manager.h" |
| 60 #include "components/sync/test/engine/mock_nudge_handler.h" | 61 #include "components/sync/test/engine/mock_nudge_handler.h" |
| 61 #include "components/sync/test/engine/test_directory_setter_upper.h" | 62 #include "components/sync/test/engine/test_directory_setter_upper.h" |
| 62 #include "components/sync/test/engine/test_id_factory.h" | 63 #include "components/sync/test/engine/test_id_factory.h" |
| 63 #include "components/sync/test/engine/test_syncable_utils.h" | 64 #include "components/sync/test/engine/test_syncable_utils.h" |
| 64 #include "components/sync/test/fake_sync_encryption_handler.h" | 65 #include "components/sync/test/fake_sync_encryption_handler.h" |
| 65 #include "components/sync/test/sessions/mock_debug_info_getter.h" | |
| 66 #include "testing/gmock/include/gmock/gmock.h" | 66 #include "testing/gmock/include/gmock/gmock.h" |
| 67 #include "testing/gtest/include/gtest/gtest.h" | 67 #include "testing/gtest/include/gtest/gtest.h" |
| 68 | 68 |
| 69 using base::TimeDelta; | 69 using base::TimeDelta; |
| 70 | 70 |
| 71 using std::count; | 71 using std::count; |
| 72 using std::map; | 72 using std::map; |
| 73 using std::multimap; | 73 using std::multimap; |
| 74 using std::set; | 74 using std::set; |
| 75 using std::string; | 75 using std::string; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 89 using syncable::WriteTransaction; | 89 using syncable::WriteTransaction; |
| 90 | 90 |
| 91 using syncable::CREATE; | 91 using syncable::CREATE; |
| 92 using syncable::GET_BY_HANDLE; | 92 using syncable::GET_BY_HANDLE; |
| 93 using syncable::GET_BY_ID; | 93 using syncable::GET_BY_ID; |
| 94 using syncable::GET_BY_CLIENT_TAG; | 94 using syncable::GET_BY_CLIENT_TAG; |
| 95 using syncable::GET_BY_SERVER_TAG; | 95 using syncable::GET_BY_SERVER_TAG; |
| 96 using syncable::GET_TYPE_ROOT; | 96 using syncable::GET_TYPE_ROOT; |
| 97 using syncable::UNITTEST; | 97 using syncable::UNITTEST; |
| 98 | 98 |
| 99 using sessions::MockDebugInfoGetter; | |
| 100 using sessions::StatusController; | |
| 101 using sessions::SyncSessionContext; | |
| 102 using sessions::SyncSession; | |
| 103 | |
| 104 namespace { | 99 namespace { |
| 105 | 100 |
| 106 // A helper to hold on to the counters emitted by the sync engine. | 101 // A helper to hold on to the counters emitted by the sync engine. |
| 107 class TypeDebugInfoCache : public TypeDebugInfoObserver { | 102 class TypeDebugInfoCache : public TypeDebugInfoObserver { |
| 108 public: | 103 public: |
| 109 TypeDebugInfoCache(); | 104 TypeDebugInfoCache(); |
| 110 ~TypeDebugInfoCache() override; | 105 ~TypeDebugInfoCache() override; |
| 111 | 106 |
| 112 CommitCounters GetLatestCommitCounters(ModelType type) const; | 107 CommitCounters GetLatestCommitCounters(ModelType type) const; |
| 113 UpdateCounters GetLatestUpdateCounters(ModelType type) const; | 108 UpdateCounters GetLatestUpdateCounters(ModelType type) const; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 | 173 |
| 179 void TypeDebugInfoCache::OnStatusCountersUpdated( | 174 void TypeDebugInfoCache::OnStatusCountersUpdated( |
| 180 syncer::ModelType type, | 175 syncer::ModelType type, |
| 181 const StatusCounters& counters) { | 176 const StatusCounters& counters) { |
| 182 status_counters_map_[type] = counters; | 177 status_counters_map_[type] = counters; |
| 183 } | 178 } |
| 184 | 179 |
| 185 } // namespace | 180 } // namespace |
| 186 | 181 |
| 187 class SyncerTest : public testing::Test, | 182 class SyncerTest : public testing::Test, |
| 188 public SyncSession::Delegate, | 183 public SyncCycle::Delegate, |
| 189 public SyncEngineEventListener { | 184 public SyncEngineEventListener { |
| 190 protected: | 185 protected: |
| 191 SyncerTest() | 186 SyncerTest() |
| 192 : extensions_activity_(new ExtensionsActivity), | 187 : extensions_activity_(new ExtensionsActivity), |
| 193 syncer_(NULL), | 188 syncer_(NULL), |
| 194 last_client_invalidation_hint_buffer_size_(10) {} | 189 last_client_invalidation_hint_buffer_size_(10) {} |
| 195 | 190 |
| 196 // SyncSession::Delegate implementation. | 191 // SyncCycle::Delegate implementation. |
| 197 void OnThrottled(const base::TimeDelta& throttle_duration) override { | 192 void OnThrottled(const base::TimeDelta& throttle_duration) override { |
| 198 FAIL() << "Should not get silenced."; | 193 FAIL() << "Should not get silenced."; |
| 199 } | 194 } |
| 200 void OnTypesThrottled(ModelTypeSet types, | 195 void OnTypesThrottled(ModelTypeSet types, |
| 201 const base::TimeDelta& throttle_duration) override { | 196 const base::TimeDelta& throttle_duration) override { |
| 202 scheduler_->OnTypesThrottled(types, throttle_duration); | 197 scheduler_->OnTypesThrottled(types, throttle_duration); |
| 203 } | 198 } |
| 204 bool IsCurrentlyThrottled() override { return false; } | 199 bool IsCurrentlyThrottled() override { return false; } |
| 205 void OnReceivedLongPollIntervalUpdate( | 200 void OnReceivedLongPollIntervalUpdate( |
| 206 const base::TimeDelta& new_interval) override { | 201 const base::TimeDelta& new_interval) override { |
| 207 last_long_poll_interval_received_ = new_interval; | 202 last_long_poll_interval_received_ = new_interval; |
| 208 } | 203 } |
| 209 void OnReceivedShortPollIntervalUpdate( | 204 void OnReceivedShortPollIntervalUpdate( |
| 210 const base::TimeDelta& new_interval) override { | 205 const base::TimeDelta& new_interval) override { |
| 211 last_short_poll_interval_received_ = new_interval; | 206 last_short_poll_interval_received_ = new_interval; |
| 212 } | 207 } |
| 213 void OnReceivedCustomNudgeDelays( | 208 void OnReceivedCustomNudgeDelays( |
| 214 const std::map<ModelType, base::TimeDelta>& delay_map) override { | 209 const std::map<ModelType, base::TimeDelta>& delay_map) override { |
| 215 std::map<ModelType, base::TimeDelta>::const_iterator iter = | 210 std::map<ModelType, base::TimeDelta>::const_iterator iter = |
| 216 delay_map.find(SESSIONS); | 211 delay_map.find(SESSIONS); |
| 217 if (iter != delay_map.end() && iter->second > base::TimeDelta()) | 212 if (iter != delay_map.end() && iter->second > base::TimeDelta()) |
| 218 last_sessions_commit_delay_ = iter->second; | 213 last_cycles_commit_delay_ = iter->second; |
|
skym
2016/08/19 17:17:43
I think this is suppose to be session
maxbogue
2016/08/19 19:12:01
Done.
| |
| 219 iter = delay_map.find(BOOKMARKS); | 214 iter = delay_map.find(BOOKMARKS); |
| 220 if (iter != delay_map.end() && iter->second > base::TimeDelta()) | 215 if (iter != delay_map.end() && iter->second > base::TimeDelta()) |
| 221 last_bookmarks_commit_delay_ = iter->second; | 216 last_bookmarks_commit_delay_ = iter->second; |
| 222 } | 217 } |
| 223 void OnReceivedClientInvalidationHintBufferSize(int size) override { | 218 void OnReceivedClientInvalidationHintBufferSize(int size) override { |
| 224 last_client_invalidation_hint_buffer_size_ = size; | 219 last_client_invalidation_hint_buffer_size_ = size; |
| 225 } | 220 } |
| 226 void OnReceivedGuRetryDelay(const base::TimeDelta& delay) override {} | 221 void OnReceivedGuRetryDelay(const base::TimeDelta& delay) override {} |
| 227 void OnReceivedMigrationRequest(ModelTypeSet types) override {} | 222 void OnReceivedMigrationRequest(ModelTypeSet types) override {} |
| 228 void OnProtocolEvent(const ProtocolEvent& event) override {} | 223 void OnProtocolEvent(const ProtocolEvent& event) override {} |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 248 default: | 243 default: |
| 249 FAIL() << "Handling unknown error type in unit tests!!"; | 244 FAIL() << "Handling unknown error type in unit tests!!"; |
| 250 } | 245 } |
| 251 } | 246 } |
| 252 | 247 |
| 253 void OnActionableError(const SyncProtocolError& error) override {} | 248 void OnActionableError(const SyncProtocolError& error) override {} |
| 254 void OnRetryTimeChanged(base::Time retry_time) override {} | 249 void OnRetryTimeChanged(base::Time retry_time) override {} |
| 255 void OnThrottledTypesChanged(ModelTypeSet throttled_types) override {} | 250 void OnThrottledTypesChanged(ModelTypeSet throttled_types) override {} |
| 256 void OnMigrationRequested(ModelTypeSet types) override {} | 251 void OnMigrationRequested(ModelTypeSet types) override {} |
| 257 | 252 |
| 258 void ResetSession() { | 253 void ResetSession() { cycle_.reset(SyncCycle::Build(context_.get(), this)); } |
|
skym
2016/08/19 17:17:43
This should be ResetCycle()
maxbogue
2016/08/19 19:12:01
Done.
| |
| 259 session_.reset(SyncSession::Build(context_.get(), this)); | |
| 260 } | |
| 261 | 254 |
| 262 bool SyncShareNudge() { | 255 bool SyncShareNudge() { |
| 263 ResetSession(); | 256 ResetSession(); |
| 264 | 257 |
| 265 // Pretend we've seen a local change, to make the nudge_tracker look normal. | 258 // Pretend we've seen a local change, to make the nudge_tracker look normal. |
| 266 nudge_tracker_.RecordLocalChange(ModelTypeSet(BOOKMARKS)); | 259 nudge_tracker_.RecordLocalChange(ModelTypeSet(BOOKMARKS)); |
| 267 | 260 |
| 268 return syncer_->NormalSyncShare(context_->GetEnabledTypes(), | 261 return syncer_->NormalSyncShare(context_->GetEnabledTypes(), |
| 269 &nudge_tracker_, session_.get()); | 262 &nudge_tracker_, cycle_.get()); |
| 270 } | 263 } |
| 271 | 264 |
| 272 bool SyncShareConfigure() { | 265 bool SyncShareConfigure() { |
| 273 ResetSession(); | 266 ResetSession(); |
| 274 return syncer_->ConfigureSyncShare( | 267 return syncer_->ConfigureSyncShare( |
| 275 context_->GetEnabledTypes(), | 268 context_->GetEnabledTypes(), |
| 276 sync_pb::GetUpdatesCallerInfo::RECONFIGURATION, session_.get()); | 269 sync_pb::GetUpdatesCallerInfo::RECONFIGURATION, cycle_.get()); |
| 277 } | 270 } |
| 278 | 271 |
| 279 void SetUp() override { | 272 void SetUp() override { |
| 280 dir_maker_.SetUp(); | 273 dir_maker_.SetUp(); |
| 281 mock_server_.reset( | 274 mock_server_.reset( |
| 282 new MockConnectionManager(directory(), &cancelation_signal_)); | 275 new MockConnectionManager(directory(), &cancelation_signal_)); |
| 283 debug_info_getter_.reset(new MockDebugInfoGetter); | 276 debug_info_getter_.reset(new MockDebugInfoGetter); |
| 284 EnableDatatype(BOOKMARKS); | 277 EnableDatatype(BOOKMARKS); |
| 285 EnableDatatype(EXTENSIONS); | 278 EnableDatatype(EXTENSIONS); |
| 286 EnableDatatype(NIGORI); | 279 EnableDatatype(NIGORI); |
| 287 EnableDatatype(PREFERENCES); | 280 EnableDatatype(PREFERENCES); |
| 288 EnableDatatype(NIGORI); | 281 EnableDatatype(NIGORI); |
| 289 workers_.push_back( | 282 workers_.push_back( |
| 290 scoped_refptr<ModelSafeWorker>(new FakeModelWorker(GROUP_PASSIVE))); | 283 scoped_refptr<ModelSafeWorker>(new FakeModelWorker(GROUP_PASSIVE))); |
| 291 std::vector<SyncEngineEventListener*> listeners; | 284 std::vector<SyncEngineEventListener*> listeners; |
| 292 listeners.push_back(this); | 285 listeners.push_back(this); |
| 293 | 286 |
| 294 ModelSafeRoutingInfo routing_info; | 287 ModelSafeRoutingInfo routing_info; |
| 295 GetModelSafeRoutingInfo(&routing_info); | 288 GetModelSafeRoutingInfo(&routing_info); |
| 296 | 289 |
| 297 model_type_registry_.reset( | 290 model_type_registry_.reset( |
| 298 new ModelTypeRegistry(workers_, directory(), &mock_nudge_handler_)); | 291 new ModelTypeRegistry(workers_, directory(), &mock_nudge_handler_)); |
| 299 model_type_registry_->RegisterDirectoryTypeDebugInfoObserver( | 292 model_type_registry_->RegisterDirectoryTypeDebugInfoObserver( |
| 300 &debug_info_cache_); | 293 &debug_info_cache_); |
| 301 | 294 |
| 302 context_.reset(new SyncSessionContext( | 295 context_.reset(new SyncCycleContext( |
| 303 mock_server_.get(), directory(), extensions_activity_.get(), listeners, | 296 mock_server_.get(), directory(), extensions_activity_.get(), listeners, |
| 304 debug_info_getter_.get(), model_type_registry_.get(), | 297 debug_info_getter_.get(), model_type_registry_.get(), |
| 305 true, // enable keystore encryption | 298 true, // enable keystore encryption |
| 306 false, // force enable pre-commit GU avoidance experiment | 299 false, // force enable pre-commit GU avoidance experiment |
| 307 "fake_invalidator_client_id")); | 300 "fake_invalidator_client_id")); |
| 308 context_->SetRoutingInfo(routing_info); | 301 context_->SetRoutingInfo(routing_info); |
| 309 syncer_ = new Syncer(&cancelation_signal_); | 302 syncer_ = new Syncer(&cancelation_signal_); |
| 310 scheduler_.reset(new SyncSchedulerImpl( | 303 scheduler_.reset(new SyncSchedulerImpl( |
| 311 "TestSyncScheduler", BackoffDelayProvider::FromDefaults(), | 304 "TestSyncScheduler", BackoffDelayProvider::FromDefaults(), |
| 312 context_.get(), | 305 context_.get(), |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 538 context_->SetRoutingInfo(routing_info); | 531 context_->SetRoutingInfo(routing_info); |
| 539 } | 532 } |
| 540 | 533 |
| 541 mock_server_->ExpectGetUpdatesRequestTypes(enabled_datatypes_); | 534 mock_server_->ExpectGetUpdatesRequestTypes(enabled_datatypes_); |
| 542 } | 535 } |
| 543 | 536 |
| 544 Cryptographer* GetCryptographer(syncable::BaseTransaction* trans) { | 537 Cryptographer* GetCryptographer(syncable::BaseTransaction* trans) { |
| 545 return directory()->GetCryptographer(trans); | 538 return directory()->GetCryptographer(trans); |
| 546 } | 539 } |
| 547 | 540 |
| 548 // Configures SyncSessionContext and NudgeTracker so Syncer won't call | 541 // Configures SyncCycleContext and NudgeTracker so Syncer won't call |
| 549 // GetUpdates prior to Commit. This method can be used to ensure a Commit is | 542 // GetUpdates prior to Commit. This method can be used to ensure a Commit is |
| 550 // not preceeded by GetUpdates. | 543 // not preceeded by GetUpdates. |
| 551 void ConfigureNoGetUpdatesRequired() { | 544 void ConfigureNoGetUpdatesRequired() { |
| 552 context_->set_server_enabled_pre_commit_update_avoidance(true); | 545 context_->set_server_enabled_pre_commit_update_avoidance(true); |
| 553 nudge_tracker_.OnInvalidationsEnabled(); | 546 nudge_tracker_.OnInvalidationsEnabled(); |
| 554 nudge_tracker_.RecordSuccessfulSyncCycle(); | 547 nudge_tracker_.RecordSuccessfulSyncCycle(); |
| 555 | 548 |
| 556 ASSERT_FALSE(context_->ShouldFetchUpdatesBeforeCommit()); | 549 ASSERT_FALSE(context_->ShouldFetchUpdatesBeforeCommit()); |
| 557 ASSERT_FALSE(nudge_tracker_.IsGetUpdatesRequired()); | 550 ASSERT_FALSE(nudge_tracker_.IsGetUpdatesRequired()); |
| 558 } | 551 } |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 570 TestIdFactory ids_; | 563 TestIdFactory ids_; |
| 571 | 564 |
| 572 TestDirectorySetterUpper dir_maker_; | 565 TestDirectorySetterUpper dir_maker_; |
| 573 FakeEncryptor encryptor_; | 566 FakeEncryptor encryptor_; |
| 574 scoped_refptr<ExtensionsActivity> extensions_activity_; | 567 scoped_refptr<ExtensionsActivity> extensions_activity_; |
| 575 std::unique_ptr<MockConnectionManager> mock_server_; | 568 std::unique_ptr<MockConnectionManager> mock_server_; |
| 576 CancelationSignal cancelation_signal_; | 569 CancelationSignal cancelation_signal_; |
| 577 | 570 |
| 578 Syncer* syncer_; | 571 Syncer* syncer_; |
| 579 | 572 |
| 580 std::unique_ptr<SyncSession> session_; | 573 std::unique_ptr<SyncCycle> cycle_; |
| 581 TypeDebugInfoCache debug_info_cache_; | 574 TypeDebugInfoCache debug_info_cache_; |
| 582 MockNudgeHandler mock_nudge_handler_; | 575 MockNudgeHandler mock_nudge_handler_; |
| 583 std::unique_ptr<ModelTypeRegistry> model_type_registry_; | 576 std::unique_ptr<ModelTypeRegistry> model_type_registry_; |
| 584 std::unique_ptr<SyncSchedulerImpl> scheduler_; | 577 std::unique_ptr<SyncSchedulerImpl> scheduler_; |
| 585 std::unique_ptr<SyncSessionContext> context_; | 578 std::unique_ptr<SyncCycleContext> context_; |
| 586 base::TimeDelta last_short_poll_interval_received_; | 579 base::TimeDelta last_short_poll_interval_received_; |
| 587 base::TimeDelta last_long_poll_interval_received_; | 580 base::TimeDelta last_long_poll_interval_received_; |
| 588 base::TimeDelta last_sessions_commit_delay_; | 581 base::TimeDelta last_cycles_commit_delay_; |
|
skym
2016/08/19 17:17:43
Should be session
maxbogue
2016/08/19 19:12:01
Done.
| |
| 589 base::TimeDelta last_bookmarks_commit_delay_; | 582 base::TimeDelta last_bookmarks_commit_delay_; |
| 590 int last_client_invalidation_hint_buffer_size_; | 583 int last_client_invalidation_hint_buffer_size_; |
| 591 std::vector<scoped_refptr<ModelSafeWorker>> workers_; | 584 std::vector<scoped_refptr<ModelSafeWorker>> workers_; |
| 592 | 585 |
| 593 ModelTypeSet enabled_datatypes_; | 586 ModelTypeSet enabled_datatypes_; |
| 594 sessions::NudgeTracker nudge_tracker_; | 587 NudgeTracker nudge_tracker_; |
| 595 std::unique_ptr<MockDebugInfoGetter> debug_info_getter_; | 588 std::unique_ptr<MockDebugInfoGetter> debug_info_getter_; |
| 596 | 589 |
| 597 private: | 590 private: |
| 598 DISALLOW_COPY_AND_ASSIGN(SyncerTest); | 591 DISALLOW_COPY_AND_ASSIGN(SyncerTest); |
| 599 }; | 592 }; |
| 600 | 593 |
| 601 TEST_F(SyncerTest, TestCallGatherUnsyncedEntries) { | 594 TEST_F(SyncerTest, TestCallGatherUnsyncedEntries) { |
| 602 { | 595 { |
| 603 Syncer::UnsyncedMetaHandles handles; | 596 Syncer::UnsyncedMetaHandles handles; |
| 604 { | 597 { |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 629 A.PutSpecifics(bookmark_data); | 622 A.PutSpecifics(bookmark_data); |
| 630 A.PutNonUniqueName("bookmark"); | 623 A.PutNonUniqueName("bookmark"); |
| 631 } | 624 } |
| 632 | 625 |
| 633 // Now sync without enabling bookmarks. | 626 // Now sync without enabling bookmarks. |
| 634 mock_server_->ExpectGetUpdatesRequestTypes( | 627 mock_server_->ExpectGetUpdatesRequestTypes( |
| 635 Difference(context_->GetEnabledTypes(), ModelTypeSet(BOOKMARKS))); | 628 Difference(context_->GetEnabledTypes(), ModelTypeSet(BOOKMARKS))); |
| 636 ResetSession(); | 629 ResetSession(); |
| 637 syncer_->NormalSyncShare( | 630 syncer_->NormalSyncShare( |
| 638 Difference(context_->GetEnabledTypes(), ModelTypeSet(BOOKMARKS)), | 631 Difference(context_->GetEnabledTypes(), ModelTypeSet(BOOKMARKS)), |
| 639 &nudge_tracker_, session_.get()); | 632 &nudge_tracker_, cycle_.get()); |
| 640 | 633 |
| 641 { | 634 { |
| 642 // Nothing should have been committed as bookmarks is throttled. | 635 // Nothing should have been committed as bookmarks is throttled. |
| 643 syncable::ReadTransaction rtrans(FROM_HERE, directory()); | 636 syncable::ReadTransaction rtrans(FROM_HERE, directory()); |
| 644 Entry entryA(&rtrans, syncable::GET_BY_ID, ids_.FromNumber(1)); | 637 Entry entryA(&rtrans, syncable::GET_BY_ID, ids_.FromNumber(1)); |
| 645 ASSERT_TRUE(entryA.good()); | 638 ASSERT_TRUE(entryA.good()); |
| 646 EXPECT_TRUE(entryA.GetIsUnsynced()); | 639 EXPECT_TRUE(entryA.GetIsUnsynced()); |
| 647 } | 640 } |
| 648 | 641 |
| 649 // Sync again with bookmarks enabled. | 642 // Sync again with bookmarks enabled. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 702 A.PutSpecifics(bookmark_data); | 695 A.PutSpecifics(bookmark_data); |
| 703 A.PutNonUniqueName("bookmark"); | 696 A.PutNonUniqueName("bookmark"); |
| 704 } | 697 } |
| 705 | 698 |
| 706 // Now sync without enabling bookmarks. | 699 // Now sync without enabling bookmarks. |
| 707 mock_server_->ExpectGetUpdatesRequestTypes( | 700 mock_server_->ExpectGetUpdatesRequestTypes( |
| 708 Difference(context_->GetEnabledTypes(), ModelTypeSet(BOOKMARKS))); | 701 Difference(context_->GetEnabledTypes(), ModelTypeSet(BOOKMARKS))); |
| 709 ResetSession(); | 702 ResetSession(); |
| 710 syncer_->NormalSyncShare( | 703 syncer_->NormalSyncShare( |
| 711 Difference(context_->GetEnabledTypes(), ModelTypeSet(BOOKMARKS)), | 704 Difference(context_->GetEnabledTypes(), ModelTypeSet(BOOKMARKS)), |
| 712 &nudge_tracker_, session_.get()); | 705 &nudge_tracker_, cycle_.get()); |
| 713 | 706 |
| 714 { | 707 { |
| 715 // Nothing should have been committed as bookmarks is throttled. | 708 // Nothing should have been committed as bookmarks is throttled. |
| 716 histogram_tester.ExpectTotalCount("DataUse.Sync.Upload.Count", 0); | 709 histogram_tester.ExpectTotalCount("DataUse.Sync.Upload.Count", 0); |
| 717 histogram_tester.ExpectTotalCount("DataUse.Sync.Upload.Bytes", 0); | 710 histogram_tester.ExpectTotalCount("DataUse.Sync.Upload.Bytes", 0); |
| 718 histogram_tester.ExpectTotalCount("DataUse.Sync.Download.Count", 1); | 711 histogram_tester.ExpectTotalCount("DataUse.Sync.Download.Count", 1); |
| 719 histogram_tester.ExpectUniqueSample("DataUse.Sync.Download.Count", | 712 histogram_tester.ExpectUniqueSample("DataUse.Sync.Download.Count", |
| 720 BOOKMARKS, 1); | 713 BOOKMARKS, 1); |
| 721 | 714 |
| 722 samples = histogram_tester.GetAllSamples("DataUse.Sync.Download.Bytes"); | 715 samples = histogram_tester.GetAllSamples("DataUse.Sync.Download.Bytes"); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 880 ASSERT_TRUE(C.good()); | 873 ASSERT_TRUE(C.good()); |
| 881 C.PutSpecifics(encrypted_bookmark); | 874 C.PutSpecifics(encrypted_bookmark); |
| 882 C.PutNonUniqueName(kEncryptedString); | 875 C.PutNonUniqueName(kEncryptedString); |
| 883 MutableEntry D(&wtrans, GET_BY_ID, ids_.FromNumber(4)); | 876 MutableEntry D(&wtrans, GET_BY_ID, ids_.FromNumber(4)); |
| 884 ASSERT_TRUE(D.good()); | 877 ASSERT_TRUE(D.good()); |
| 885 D.PutSpecifics(encrypted_bookmark); | 878 D.PutSpecifics(encrypted_bookmark); |
| 886 D.PutNonUniqueName(kEncryptedString); | 879 D.PutNonUniqueName(kEncryptedString); |
| 887 } | 880 } |
| 888 EXPECT_TRUE(SyncShareNudge()); | 881 EXPECT_TRUE(SyncShareNudge()); |
| 889 { | 882 { |
| 890 const StatusController& status_controller = session_->status_controller(); | 883 const StatusController& status_controller = cycle_->status_controller(); |
| 891 // Expect success. | 884 // Expect success. |
| 892 EXPECT_EQ(SYNCER_OK, status_controller.model_neutral_state().commit_result); | 885 EXPECT_EQ(SYNCER_OK, status_controller.model_neutral_state().commit_result); |
| 893 // None should be unsynced anymore. | 886 // None should be unsynced anymore. |
| 894 syncable::ReadTransaction rtrans(FROM_HERE, directory()); | 887 syncable::ReadTransaction rtrans(FROM_HERE, directory()); |
| 895 VERIFY_ENTRY(1, false, false, false, 0, 21, 21, ids_, &rtrans); | 888 VERIFY_ENTRY(1, false, false, false, 0, 21, 21, ids_, &rtrans); |
| 896 VERIFY_ENTRY(2, false, false, false, 0, 11, 11, ids_, &rtrans); | 889 VERIFY_ENTRY(2, false, false, false, 0, 11, 11, ids_, &rtrans); |
| 897 VERIFY_ENTRY(3, false, false, false, 0, 11, 11, ids_, &rtrans); | 890 VERIFY_ENTRY(3, false, false, false, 0, 11, 11, ids_, &rtrans); |
| 898 VERIFY_ENTRY(4, false, false, false, 0, 11, 11, ids_, &rtrans); | 891 VERIFY_ENTRY(4, false, false, false, 0, 11, 11, ids_, &rtrans); |
| 899 } | 892 } |
| 900 } | 893 } |
| (...skipping 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2726 entry.PutBaseVersion(1); | 2719 entry.PutBaseVersion(1); |
| 2727 entry.PutServerVersion(1); | 2720 entry.PutServerVersion(1); |
| 2728 entry.PutServerParentId(ids_.FromNumber(9999)); // Bad parent. | 2721 entry.PutServerParentId(ids_.FromNumber(9999)); // Bad parent. |
| 2729 entry.PutIsUnsynced(true); | 2722 entry.PutIsUnsynced(true); |
| 2730 entry.PutIsUnappliedUpdate(true); | 2723 entry.PutIsUnappliedUpdate(true); |
| 2731 entry.PutSpecifics(DefaultBookmarkSpecifics()); | 2724 entry.PutSpecifics(DefaultBookmarkSpecifics()); |
| 2732 entry.PutServerSpecifics(DefaultBookmarkSpecifics()); | 2725 entry.PutServerSpecifics(DefaultBookmarkSpecifics()); |
| 2733 entry.PutIsDel(false); | 2726 entry.PutIsDel(false); |
| 2734 } | 2727 } |
| 2735 EXPECT_TRUE(SyncShareNudge()); | 2728 EXPECT_TRUE(SyncShareNudge()); |
| 2736 EXPECT_EQ(1, session_->status_controller().TotalNumConflictingItems()); | 2729 EXPECT_EQ(1, cycle_->status_controller().TotalNumConflictingItems()); |
| 2737 } | 2730 } |
| 2738 | 2731 |
| 2739 // Original problem synopsis: | 2732 // Original problem synopsis: |
| 2740 // Illegal parent | 2733 // Illegal parent |
| 2741 // Unexpected error during sync if we: | 2734 // Unexpected error during sync if we: |
| 2742 // make a new folder bob | 2735 // make a new folder bob |
| 2743 // wait for sync | 2736 // wait for sync |
| 2744 // make a new folder fred | 2737 // make a new folder fred |
| 2745 // move bob into fred | 2738 // move bob into fred |
| 2746 // remove bob | 2739 // remove bob |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2983 entry.PutIsUnsynced(true); | 2976 entry.PutIsUnsynced(true); |
| 2984 entry.PutIsUnappliedUpdate(true); | 2977 entry.PutIsUnappliedUpdate(true); |
| 2985 entry.PutSpecifics(DefaultPreferencesSpecifics()); | 2978 entry.PutSpecifics(DefaultPreferencesSpecifics()); |
| 2986 entry.PutServerSpecifics(DefaultPreferencesSpecifics()); | 2979 entry.PutServerSpecifics(DefaultPreferencesSpecifics()); |
| 2987 entry.PutIsDel(false); | 2980 entry.PutIsDel(false); |
| 2988 } | 2981 } |
| 2989 | 2982 |
| 2990 EXPECT_TRUE(SyncShareNudge()); | 2983 EXPECT_TRUE(SyncShareNudge()); |
| 2991 // Since the hierarchy isn't really changed (the type has flat hierarchy) | 2984 // Since the hierarchy isn't really changed (the type has flat hierarchy) |
| 2992 // this conflict must be discarded. | 2985 // this conflict must be discarded. |
| 2993 EXPECT_EQ(0, session_->status_controller().num_local_overwrites()); | 2986 EXPECT_EQ(0, cycle_->status_controller().num_local_overwrites()); |
| 2994 EXPECT_EQ(0, session_->status_controller().num_server_overwrites()); | 2987 EXPECT_EQ(0, cycle_->status_controller().num_server_overwrites()); |
| 2995 } | 2988 } |
| 2996 | 2989 |
| 2997 TEST_F(SyncerTest, DeletingEntryWithLocalEdits) { | 2990 TEST_F(SyncerTest, DeletingEntryWithLocalEdits) { |
| 2998 int64_t newfolder_metahandle; | 2991 int64_t newfolder_metahandle; |
| 2999 | 2992 |
| 3000 mock_server_->AddUpdateDirectory(1, 0, "bob", 1, 10, foreign_cache_guid(), | 2993 mock_server_->AddUpdateDirectory(1, 0, "bob", 1, 10, foreign_cache_guid(), |
| 3001 "-1"); | 2994 "-1"); |
| 3002 EXPECT_TRUE(SyncShareNudge()); | 2995 EXPECT_TRUE(SyncShareNudge()); |
| 3003 { | 2996 { |
| 3004 WriteTransaction trans(FROM_HERE, UNITTEST, directory()); | 2997 WriteTransaction trans(FROM_HERE, UNITTEST, directory()); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3134 } | 3127 } |
| 3135 ASSERT_EQ(items_to_commit, directory()->unsynced_entity_count()); | 3128 ASSERT_EQ(items_to_commit, directory()->unsynced_entity_count()); |
| 3136 | 3129 |
| 3137 // The second commit should fail. It will be preceded by one successful | 3130 // The second commit should fail. It will be preceded by one successful |
| 3138 // GetUpdate and one succesful commit. | 3131 // GetUpdate and one succesful commit. |
| 3139 mock_server_->FailNthPostBufferToPathCall(3); | 3132 mock_server_->FailNthPostBufferToPathCall(3); |
| 3140 EXPECT_FALSE(SyncShareNudge()); | 3133 EXPECT_FALSE(SyncShareNudge()); |
| 3141 | 3134 |
| 3142 EXPECT_EQ(1U, mock_server_->commit_messages().size()); | 3135 EXPECT_EQ(1U, mock_server_->commit_messages().size()); |
| 3143 EXPECT_EQ(SYNC_SERVER_ERROR, | 3136 EXPECT_EQ(SYNC_SERVER_ERROR, |
| 3144 session_->status_controller().model_neutral_state().commit_result); | 3137 cycle_->status_controller().model_neutral_state().commit_result); |
| 3145 EXPECT_EQ(items_to_commit - kDefaultMaxCommitBatchSize, | 3138 EXPECT_EQ(items_to_commit - kDefaultMaxCommitBatchSize, |
| 3146 directory()->unsynced_entity_count()); | 3139 directory()->unsynced_entity_count()); |
| 3147 } | 3140 } |
| 3148 | 3141 |
| 3149 // Test that a single conflict response from the server will cause us to exit | 3142 // Test that a single conflict response from the server will cause us to exit |
| 3150 // the commit loop immediately. | 3143 // the commit loop immediately. |
| 3151 TEST_F(SyncerTest, CommitManyItemsInOneGo_CommitConflict) { | 3144 TEST_F(SyncerTest, CommitManyItemsInOneGo_CommitConflict) { |
| 3152 uint32_t num_batches = 2; | 3145 uint32_t num_batches = 2; |
| 3153 uint32_t items_to_commit = kDefaultMaxCommitBatchSize * num_batches; | 3146 uint32_t items_to_commit = kDefaultMaxCommitBatchSize * num_batches; |
| 3154 { | 3147 { |
| (...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4100 GetSpecificsFieldNumberFromModelType(BOOKMARKS)); | 4093 GetSpecificsFieldNumberFromModelType(BOOKMARKS)); |
| 4101 bookmark_delay->set_delay_ms(950); | 4094 bookmark_delay->set_delay_ms(950); |
| 4102 command->set_client_invalidation_hint_buffer_size(11); | 4095 command->set_client_invalidation_hint_buffer_size(11); |
| 4103 mock_server_->AddUpdateDirectory(1, 0, "in_root", 1, 1, foreign_cache_guid(), | 4096 mock_server_->AddUpdateDirectory(1, 0, "in_root", 1, 1, foreign_cache_guid(), |
| 4104 "-1"); | 4097 "-1"); |
| 4105 mock_server_->SetGUClientCommand(command); | 4098 mock_server_->SetGUClientCommand(command); |
| 4106 EXPECT_TRUE(SyncShareNudge()); | 4099 EXPECT_TRUE(SyncShareNudge()); |
| 4107 | 4100 |
| 4108 EXPECT_EQ(TimeDelta::FromSeconds(8), last_short_poll_interval_received_); | 4101 EXPECT_EQ(TimeDelta::FromSeconds(8), last_short_poll_interval_received_); |
| 4109 EXPECT_EQ(TimeDelta::FromSeconds(800), last_long_poll_interval_received_); | 4102 EXPECT_EQ(TimeDelta::FromSeconds(800), last_long_poll_interval_received_); |
| 4110 EXPECT_EQ(TimeDelta::FromSeconds(3141), last_sessions_commit_delay_); | 4103 EXPECT_EQ(TimeDelta::FromSeconds(3141), last_cycles_commit_delay_); |
| 4111 EXPECT_EQ(TimeDelta::FromMilliseconds(950), last_bookmarks_commit_delay_); | 4104 EXPECT_EQ(TimeDelta::FromMilliseconds(950), last_bookmarks_commit_delay_); |
| 4112 EXPECT_EQ(11, last_client_invalidation_hint_buffer_size_); | 4105 EXPECT_EQ(11, last_client_invalidation_hint_buffer_size_); |
| 4113 | 4106 |
| 4114 command = new ClientCommand(); | 4107 command = new ClientCommand(); |
| 4115 command->set_set_sync_poll_interval(180); | 4108 command->set_set_sync_poll_interval(180); |
| 4116 command->set_set_sync_long_poll_interval(190); | 4109 command->set_set_sync_long_poll_interval(190); |
| 4117 command->set_sessions_commit_delay_seconds(2718); | 4110 command->set_sessions_commit_delay_seconds(2718); |
| 4118 bookmark_delay = command->add_custom_nudge_delays(); | 4111 bookmark_delay = command->add_custom_nudge_delays(); |
| 4119 bookmark_delay->set_datatype_id( | 4112 bookmark_delay->set_datatype_id( |
| 4120 GetSpecificsFieldNumberFromModelType(BOOKMARKS)); | 4113 GetSpecificsFieldNumberFromModelType(BOOKMARKS)); |
| 4121 bookmark_delay->set_delay_ms(1050); | 4114 bookmark_delay->set_delay_ms(1050); |
| 4122 command->set_client_invalidation_hint_buffer_size(9); | 4115 command->set_client_invalidation_hint_buffer_size(9); |
| 4123 mock_server_->AddUpdateDirectory(1, 0, "in_root", 1, 1, foreign_cache_guid(), | 4116 mock_server_->AddUpdateDirectory(1, 0, "in_root", 1, 1, foreign_cache_guid(), |
| 4124 "-1"); | 4117 "-1"); |
| 4125 mock_server_->SetGUClientCommand(command); | 4118 mock_server_->SetGUClientCommand(command); |
| 4126 EXPECT_TRUE(SyncShareNudge()); | 4119 EXPECT_TRUE(SyncShareNudge()); |
| 4127 | 4120 |
| 4128 EXPECT_EQ(TimeDelta::FromSeconds(180), last_short_poll_interval_received_); | 4121 EXPECT_EQ(TimeDelta::FromSeconds(180), last_short_poll_interval_received_); |
| 4129 EXPECT_EQ(TimeDelta::FromSeconds(190), last_long_poll_interval_received_); | 4122 EXPECT_EQ(TimeDelta::FromSeconds(190), last_long_poll_interval_received_); |
| 4130 EXPECT_EQ(TimeDelta::FromSeconds(2718), last_sessions_commit_delay_); | 4123 EXPECT_EQ(TimeDelta::FromSeconds(2718), last_cycles_commit_delay_); |
| 4131 EXPECT_EQ(TimeDelta::FromMilliseconds(1050), last_bookmarks_commit_delay_); | 4124 EXPECT_EQ(TimeDelta::FromMilliseconds(1050), last_bookmarks_commit_delay_); |
| 4132 EXPECT_EQ(9, last_client_invalidation_hint_buffer_size_); | 4125 EXPECT_EQ(9, last_client_invalidation_hint_buffer_size_); |
| 4133 } | 4126 } |
| 4134 | 4127 |
| 4135 TEST_F(SyncerTest, TestClientCommandDuringCommit) { | 4128 TEST_F(SyncerTest, TestClientCommandDuringCommit) { |
| 4136 using sync_pb::ClientCommand; | 4129 using sync_pb::ClientCommand; |
| 4137 | 4130 |
| 4138 ClientCommand* command = new ClientCommand(); | 4131 ClientCommand* command = new ClientCommand(); |
| 4139 command->set_set_sync_poll_interval(8); | 4132 command->set_set_sync_poll_interval(8); |
| 4140 command->set_set_sync_long_poll_interval(800); | 4133 command->set_set_sync_long_poll_interval(800); |
| 4141 command->set_sessions_commit_delay_seconds(3141); | 4134 command->set_sessions_commit_delay_seconds(3141); |
| 4142 sync_pb::CustomNudgeDelay* bookmark_delay = | 4135 sync_pb::CustomNudgeDelay* bookmark_delay = |
| 4143 command->add_custom_nudge_delays(); | 4136 command->add_custom_nudge_delays(); |
| 4144 bookmark_delay->set_datatype_id( | 4137 bookmark_delay->set_datatype_id( |
| 4145 GetSpecificsFieldNumberFromModelType(BOOKMARKS)); | 4138 GetSpecificsFieldNumberFromModelType(BOOKMARKS)); |
| 4146 bookmark_delay->set_delay_ms(950); | 4139 bookmark_delay->set_delay_ms(950); |
| 4147 command->set_client_invalidation_hint_buffer_size(11); | 4140 command->set_client_invalidation_hint_buffer_size(11); |
| 4148 CreateUnsyncedDirectory("X", "id_X"); | 4141 CreateUnsyncedDirectory("X", "id_X"); |
| 4149 mock_server_->SetCommitClientCommand(command); | 4142 mock_server_->SetCommitClientCommand(command); |
| 4150 EXPECT_TRUE(SyncShareNudge()); | 4143 EXPECT_TRUE(SyncShareNudge()); |
| 4151 | 4144 |
| 4152 EXPECT_EQ(TimeDelta::FromSeconds(8), last_short_poll_interval_received_); | 4145 EXPECT_EQ(TimeDelta::FromSeconds(8), last_short_poll_interval_received_); |
| 4153 EXPECT_EQ(TimeDelta::FromSeconds(800), last_long_poll_interval_received_); | 4146 EXPECT_EQ(TimeDelta::FromSeconds(800), last_long_poll_interval_received_); |
| 4154 EXPECT_EQ(TimeDelta::FromSeconds(3141), last_sessions_commit_delay_); | 4147 EXPECT_EQ(TimeDelta::FromSeconds(3141), last_cycles_commit_delay_); |
| 4155 EXPECT_EQ(TimeDelta::FromMilliseconds(950), last_bookmarks_commit_delay_); | 4148 EXPECT_EQ(TimeDelta::FromMilliseconds(950), last_bookmarks_commit_delay_); |
| 4156 EXPECT_EQ(11, last_client_invalidation_hint_buffer_size_); | 4149 EXPECT_EQ(11, last_client_invalidation_hint_buffer_size_); |
| 4157 | 4150 |
| 4158 command = new ClientCommand(); | 4151 command = new ClientCommand(); |
| 4159 command->set_set_sync_poll_interval(180); | 4152 command->set_set_sync_poll_interval(180); |
| 4160 command->set_set_sync_long_poll_interval(190); | 4153 command->set_set_sync_long_poll_interval(190); |
| 4161 command->set_sessions_commit_delay_seconds(2718); | 4154 command->set_sessions_commit_delay_seconds(2718); |
| 4162 bookmark_delay = command->add_custom_nudge_delays(); | 4155 bookmark_delay = command->add_custom_nudge_delays(); |
| 4163 bookmark_delay->set_datatype_id( | 4156 bookmark_delay->set_datatype_id( |
| 4164 GetSpecificsFieldNumberFromModelType(BOOKMARKS)); | 4157 GetSpecificsFieldNumberFromModelType(BOOKMARKS)); |
| 4165 bookmark_delay->set_delay_ms(1050); | 4158 bookmark_delay->set_delay_ms(1050); |
| 4166 command->set_client_invalidation_hint_buffer_size(9); | 4159 command->set_client_invalidation_hint_buffer_size(9); |
| 4167 CreateUnsyncedDirectory("Y", "id_Y"); | 4160 CreateUnsyncedDirectory("Y", "id_Y"); |
| 4168 mock_server_->SetCommitClientCommand(command); | 4161 mock_server_->SetCommitClientCommand(command); |
| 4169 EXPECT_TRUE(SyncShareNudge()); | 4162 EXPECT_TRUE(SyncShareNudge()); |
| 4170 | 4163 |
| 4171 EXPECT_EQ(TimeDelta::FromSeconds(180), last_short_poll_interval_received_); | 4164 EXPECT_EQ(TimeDelta::FromSeconds(180), last_short_poll_interval_received_); |
| 4172 EXPECT_EQ(TimeDelta::FromSeconds(190), last_long_poll_interval_received_); | 4165 EXPECT_EQ(TimeDelta::FromSeconds(190), last_long_poll_interval_received_); |
| 4173 EXPECT_EQ(TimeDelta::FromSeconds(2718), last_sessions_commit_delay_); | 4166 EXPECT_EQ(TimeDelta::FromSeconds(2718), last_cycles_commit_delay_); |
| 4174 EXPECT_EQ(TimeDelta::FromMilliseconds(1050), last_bookmarks_commit_delay_); | 4167 EXPECT_EQ(TimeDelta::FromMilliseconds(1050), last_bookmarks_commit_delay_); |
| 4175 EXPECT_EQ(9, last_client_invalidation_hint_buffer_size_); | 4168 EXPECT_EQ(9, last_client_invalidation_hint_buffer_size_); |
| 4176 } | 4169 } |
| 4177 | 4170 |
| 4178 TEST_F(SyncerTest, EnsureWeSendUpOldParent) { | 4171 TEST_F(SyncerTest, EnsureWeSendUpOldParent) { |
| 4179 syncable::Id folder_one_id = ids_.FromNumber(1); | 4172 syncable::Id folder_one_id = ids_.FromNumber(1); |
| 4180 syncable::Id folder_two_id = ids_.FromNumber(2); | 4173 syncable::Id folder_two_id = ids_.FromNumber(2); |
| 4181 | 4174 |
| 4182 mock_server_->AddUpdateDirectory(folder_one_id, TestIdFactory::root(), | 4175 mock_server_->AddUpdateDirectory(folder_one_id, TestIdFactory::root(), |
| 4183 "folder_one", 1, 1, foreign_cache_guid(), | 4176 "folder_one", 1, 1, foreign_cache_guid(), |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4979 } | 4972 } |
| 4980 | 4973 |
| 4981 TEST_F(SyncerTest, GetKeySuccess) { | 4974 TEST_F(SyncerTest, GetKeySuccess) { |
| 4982 { | 4975 { |
| 4983 syncable::ReadTransaction rtrans(FROM_HERE, directory()); | 4976 syncable::ReadTransaction rtrans(FROM_HERE, directory()); |
| 4984 EXPECT_TRUE(directory()->GetNigoriHandler()->NeedKeystoreKey(&rtrans)); | 4977 EXPECT_TRUE(directory()->GetNigoriHandler()->NeedKeystoreKey(&rtrans)); |
| 4985 } | 4978 } |
| 4986 | 4979 |
| 4987 SyncShareConfigure(); | 4980 SyncShareConfigure(); |
| 4988 | 4981 |
| 4989 EXPECT_EQ(SYNCER_OK, session_->status_controller().last_get_key_result()); | 4982 EXPECT_EQ(SYNCER_OK, cycle_->status_controller().last_get_key_result()); |
| 4990 { | 4983 { |
| 4991 syncable::ReadTransaction rtrans(FROM_HERE, directory()); | 4984 syncable::ReadTransaction rtrans(FROM_HERE, directory()); |
| 4992 EXPECT_FALSE(directory()->GetNigoriHandler()->NeedKeystoreKey(&rtrans)); | 4985 EXPECT_FALSE(directory()->GetNigoriHandler()->NeedKeystoreKey(&rtrans)); |
| 4993 } | 4986 } |
| 4994 } | 4987 } |
| 4995 | 4988 |
| 4996 TEST_F(SyncerTest, GetKeyEmpty) { | 4989 TEST_F(SyncerTest, GetKeyEmpty) { |
| 4997 { | 4990 { |
| 4998 syncable::ReadTransaction rtrans(FROM_HERE, directory()); | 4991 syncable::ReadTransaction rtrans(FROM_HERE, directory()); |
| 4999 EXPECT_TRUE(directory()->GetNigoriHandler()->NeedKeystoreKey(&rtrans)); | 4992 EXPECT_TRUE(directory()->GetNigoriHandler()->NeedKeystoreKey(&rtrans)); |
| 5000 } | 4993 } |
| 5001 | 4994 |
| 5002 mock_server_->SetKeystoreKey(std::string()); | 4995 mock_server_->SetKeystoreKey(std::string()); |
| 5003 SyncShareConfigure(); | 4996 SyncShareConfigure(); |
| 5004 | 4997 |
| 5005 EXPECT_NE(SYNCER_OK, session_->status_controller().last_get_key_result()); | 4998 EXPECT_NE(SYNCER_OK, cycle_->status_controller().last_get_key_result()); |
| 5006 { | 4999 { |
| 5007 syncable::ReadTransaction rtrans(FROM_HERE, directory()); | 5000 syncable::ReadTransaction rtrans(FROM_HERE, directory()); |
| 5008 EXPECT_TRUE(directory()->GetNigoriHandler()->NeedKeystoreKey(&rtrans)); | 5001 EXPECT_TRUE(directory()->GetNigoriHandler()->NeedKeystoreKey(&rtrans)); |
| 5009 } | 5002 } |
| 5010 } | 5003 } |
| 5011 | 5004 |
| 5012 // Trigger an update that contains a progress marker only and verify that | 5005 // Trigger an update that contains a progress marker only and verify that |
| 5013 // the type's permanent folder is created and the type is marked as having | 5006 // the type's permanent folder is created and the type is marked as having |
| 5014 // initial sync complete. | 5007 // initial sync complete. |
| 5015 TEST_F(SyncerTest, ProgressMarkerOnlyUpdateCreatesRootFolder) { | 5008 TEST_F(SyncerTest, ProgressMarkerOnlyUpdateCreatesRootFolder) { |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5427 syncable::Id local_id_; | 5420 syncable::Id local_id_; |
| 5428 int64_t metahandle_; | 5421 int64_t metahandle_; |
| 5429 }; | 5422 }; |
| 5430 | 5423 |
| 5431 TEST_F(SyncerUndeletionTest, UndeleteDuringCommit) { | 5424 TEST_F(SyncerUndeletionTest, UndeleteDuringCommit) { |
| 5432 Create(); | 5425 Create(); |
| 5433 ExpectUnsyncedCreation(); | 5426 ExpectUnsyncedCreation(); |
| 5434 EXPECT_TRUE(SyncShareNudge()); | 5427 EXPECT_TRUE(SyncShareNudge()); |
| 5435 | 5428 |
| 5436 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5429 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5437 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5430 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5438 ExpectSyncedAndCreated(); | 5431 ExpectSyncedAndCreated(); |
| 5439 | 5432 |
| 5440 // Delete, begin committing the delete, then undelete while committing. | 5433 // Delete, begin committing the delete, then undelete while committing. |
| 5441 Delete(); | 5434 Delete(); |
| 5442 ExpectUnsyncedDeletion(); | 5435 ExpectUnsyncedDeletion(); |
| 5443 mock_server_->SetMidCommitCallback( | 5436 mock_server_->SetMidCommitCallback( |
| 5444 base::Bind(&SyncerUndeletionTest::Undelete, base::Unretained(this))); | 5437 base::Bind(&SyncerUndeletionTest::Undelete, base::Unretained(this))); |
| 5445 EXPECT_TRUE(SyncShareNudge()); | 5438 EXPECT_TRUE(SyncShareNudge()); |
| 5446 | 5439 |
| 5447 // We will continue to commit until all nodes are synced, so we expect | 5440 // We will continue to commit until all nodes are synced, so we expect |
| 5448 // that both the delete and following undelete were committed. We haven't | 5441 // that both the delete and following undelete were committed. We haven't |
| 5449 // downloaded any updates, though, so the SERVER fields will be the same | 5442 // downloaded any updates, though, so the SERVER fields will be the same |
| 5450 // as they were at the start of the cycle. | 5443 // as they were at the start of the cycle. |
| 5451 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5444 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5452 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5445 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5453 | 5446 |
| 5454 { | 5447 { |
| 5455 syncable::ReadTransaction trans(FROM_HERE, directory()); | 5448 syncable::ReadTransaction trans(FROM_HERE, directory()); |
| 5456 Entry entry(&trans, GET_BY_HANDLE, metahandle_); | 5449 Entry entry(&trans, GET_BY_HANDLE, metahandle_); |
| 5457 | 5450 |
| 5458 // Server fields lag behind. | 5451 // Server fields lag behind. |
| 5459 EXPECT_FALSE(entry.GetServerIsDel()); | 5452 EXPECT_FALSE(entry.GetServerIsDel()); |
| 5460 | 5453 |
| 5461 // We have committed the second (undelete) update. | 5454 // We have committed the second (undelete) update. |
| 5462 EXPECT_FALSE(entry.GetIsDel()); | 5455 EXPECT_FALSE(entry.GetIsDel()); |
| 5463 EXPECT_FALSE(entry.GetIsUnsynced()); | 5456 EXPECT_FALSE(entry.GetIsUnsynced()); |
| 5464 EXPECT_FALSE(entry.GetIsUnappliedUpdate()); | 5457 EXPECT_FALSE(entry.GetIsUnappliedUpdate()); |
| 5465 } | 5458 } |
| 5466 | 5459 |
| 5467 // Now, encounter a GetUpdates corresponding to the deletion from | 5460 // Now, encounter a GetUpdates corresponding to the deletion from |
| 5468 // the server. The undeletion should prevail again and be committed. | 5461 // the server. The undeletion should prevail again and be committed. |
| 5469 // None of this should trigger any conflict detection -- it is perfectly | 5462 // None of this should trigger any conflict detection -- it is perfectly |
| 5470 // normal to recieve updates from our own commits. | 5463 // normal to recieve updates from our own commits. |
| 5471 mock_server_->SetMidCommitCallback(base::Closure()); | 5464 mock_server_->SetMidCommitCallback(base::Closure()); |
| 5472 sync_pb::SyncEntity* update = mock_server_->AddUpdateFromLastCommit(); | 5465 sync_pb::SyncEntity* update = mock_server_->AddUpdateFromLastCommit(); |
| 5473 update->set_originator_cache_guid(local_cache_guid()); | 5466 update->set_originator_cache_guid(local_cache_guid()); |
| 5474 update->set_originator_client_item_id(local_id_.GetServerId()); | 5467 update->set_originator_client_item_id(local_id_.GetServerId()); |
| 5475 | 5468 |
| 5476 EXPECT_TRUE(SyncShareNudge()); | 5469 EXPECT_TRUE(SyncShareNudge()); |
| 5477 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5470 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5478 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5471 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5479 ExpectSyncedAndCreated(); | 5472 ExpectSyncedAndCreated(); |
| 5480 } | 5473 } |
| 5481 | 5474 |
| 5482 TEST_F(SyncerUndeletionTest, UndeleteBeforeCommit) { | 5475 TEST_F(SyncerUndeletionTest, UndeleteBeforeCommit) { |
| 5483 Create(); | 5476 Create(); |
| 5484 ExpectUnsyncedCreation(); | 5477 ExpectUnsyncedCreation(); |
| 5485 EXPECT_TRUE(SyncShareNudge()); | 5478 EXPECT_TRUE(SyncShareNudge()); |
| 5486 | 5479 |
| 5487 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5480 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5488 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5481 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5489 ExpectSyncedAndCreated(); | 5482 ExpectSyncedAndCreated(); |
| 5490 | 5483 |
| 5491 // Delete and undelete, then sync to pick up the result. | 5484 // Delete and undelete, then sync to pick up the result. |
| 5492 Delete(); | 5485 Delete(); |
| 5493 ExpectUnsyncedDeletion(); | 5486 ExpectUnsyncedDeletion(); |
| 5494 Undelete(); | 5487 Undelete(); |
| 5495 ExpectUnsyncedEdit(); // Edit, not undelete: server thinks it exists. | 5488 ExpectUnsyncedEdit(); // Edit, not undelete: server thinks it exists. |
| 5496 EXPECT_TRUE(SyncShareNudge()); | 5489 EXPECT_TRUE(SyncShareNudge()); |
| 5497 | 5490 |
| 5498 // The item ought to have committed successfully. | 5491 // The item ought to have committed successfully. |
| 5499 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5492 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5500 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5493 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5501 ExpectSyncedAndCreated(); | 5494 ExpectSyncedAndCreated(); |
| 5502 { | 5495 { |
| 5503 syncable::ReadTransaction trans(FROM_HERE, directory()); | 5496 syncable::ReadTransaction trans(FROM_HERE, directory()); |
| 5504 Entry entry(&trans, GET_BY_HANDLE, metahandle_); | 5497 Entry entry(&trans, GET_BY_HANDLE, metahandle_); |
| 5505 EXPECT_EQ(2, entry.GetBaseVersion()); | 5498 EXPECT_EQ(2, entry.GetBaseVersion()); |
| 5506 } | 5499 } |
| 5507 | 5500 |
| 5508 // Now, encounter a GetUpdates corresponding to the just-committed | 5501 // Now, encounter a GetUpdates corresponding to the just-committed |
| 5509 // update. | 5502 // update. |
| 5510 sync_pb::SyncEntity* update = mock_server_->AddUpdateFromLastCommit(); | 5503 sync_pb::SyncEntity* update = mock_server_->AddUpdateFromLastCommit(); |
| 5511 update->set_originator_cache_guid(local_cache_guid()); | 5504 update->set_originator_cache_guid(local_cache_guid()); |
| 5512 update->set_originator_client_item_id(local_id_.GetServerId()); | 5505 update->set_originator_client_item_id(local_id_.GetServerId()); |
| 5513 EXPECT_TRUE(SyncShareNudge()); | 5506 EXPECT_TRUE(SyncShareNudge()); |
| 5514 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5507 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5515 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5508 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5516 ExpectSyncedAndCreated(); | 5509 ExpectSyncedAndCreated(); |
| 5517 } | 5510 } |
| 5518 | 5511 |
| 5519 TEST_F(SyncerUndeletionTest, UndeleteAfterCommitButBeforeGetUpdates) { | 5512 TEST_F(SyncerUndeletionTest, UndeleteAfterCommitButBeforeGetUpdates) { |
| 5520 Create(); | 5513 Create(); |
| 5521 ExpectUnsyncedCreation(); | 5514 ExpectUnsyncedCreation(); |
| 5522 EXPECT_TRUE(SyncShareNudge()); | 5515 EXPECT_TRUE(SyncShareNudge()); |
| 5523 | 5516 |
| 5524 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5517 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5525 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5518 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5526 ExpectSyncedAndCreated(); | 5519 ExpectSyncedAndCreated(); |
| 5527 | 5520 |
| 5528 // Delete and commit. | 5521 // Delete and commit. |
| 5529 Delete(); | 5522 Delete(); |
| 5530 ExpectUnsyncedDeletion(); | 5523 ExpectUnsyncedDeletion(); |
| 5531 EXPECT_TRUE(SyncShareNudge()); | 5524 EXPECT_TRUE(SyncShareNudge()); |
| 5532 | 5525 |
| 5533 // The item ought to have committed successfully. | 5526 // The item ought to have committed successfully. |
| 5534 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5527 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5535 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5528 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5536 ExpectSyncedAndDeleted(); | 5529 ExpectSyncedAndDeleted(); |
| 5537 | 5530 |
| 5538 // Before the GetUpdates, the item is locally undeleted. | 5531 // Before the GetUpdates, the item is locally undeleted. |
| 5539 Undelete(); | 5532 Undelete(); |
| 5540 ExpectUnsyncedUndeletion(); | 5533 ExpectUnsyncedUndeletion(); |
| 5541 | 5534 |
| 5542 // Now, encounter a GetUpdates corresponding to the just-committed | 5535 // Now, encounter a GetUpdates corresponding to the just-committed |
| 5543 // deletion update. The undeletion should prevail. | 5536 // deletion update. The undeletion should prevail. |
| 5544 mock_server_->AddUpdateFromLastCommit(); | 5537 mock_server_->AddUpdateFromLastCommit(); |
| 5545 EXPECT_TRUE(SyncShareNudge()); | 5538 EXPECT_TRUE(SyncShareNudge()); |
| 5546 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5539 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5547 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5540 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5548 ExpectSyncedAndCreated(); | 5541 ExpectSyncedAndCreated(); |
| 5549 } | 5542 } |
| 5550 | 5543 |
| 5551 TEST_F(SyncerUndeletionTest, UndeleteAfterDeleteAndGetUpdates) { | 5544 TEST_F(SyncerUndeletionTest, UndeleteAfterDeleteAndGetUpdates) { |
| 5552 Create(); | 5545 Create(); |
| 5553 ExpectUnsyncedCreation(); | 5546 ExpectUnsyncedCreation(); |
| 5554 EXPECT_TRUE(SyncShareNudge()); | 5547 EXPECT_TRUE(SyncShareNudge()); |
| 5555 | 5548 |
| 5556 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5549 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5557 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5550 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5558 ExpectSyncedAndCreated(); | 5551 ExpectSyncedAndCreated(); |
| 5559 | 5552 |
| 5560 sync_pb::SyncEntity* update = mock_server_->AddUpdateFromLastCommit(); | 5553 sync_pb::SyncEntity* update = mock_server_->AddUpdateFromLastCommit(); |
| 5561 update->set_originator_cache_guid(local_cache_guid()); | 5554 update->set_originator_cache_guid(local_cache_guid()); |
| 5562 update->set_originator_client_item_id(local_id_.GetServerId()); | 5555 update->set_originator_client_item_id(local_id_.GetServerId()); |
| 5563 EXPECT_TRUE(SyncShareNudge()); | 5556 EXPECT_TRUE(SyncShareNudge()); |
| 5564 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5557 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5565 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5558 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5566 ExpectSyncedAndCreated(); | 5559 ExpectSyncedAndCreated(); |
| 5567 | 5560 |
| 5568 // Delete and commit. | 5561 // Delete and commit. |
| 5569 Delete(); | 5562 Delete(); |
| 5570 ExpectUnsyncedDeletion(); | 5563 ExpectUnsyncedDeletion(); |
| 5571 EXPECT_TRUE(SyncShareNudge()); | 5564 EXPECT_TRUE(SyncShareNudge()); |
| 5572 | 5565 |
| 5573 // The item ought to have committed successfully. | 5566 // The item ought to have committed successfully. |
| 5574 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5567 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5575 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5568 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5576 ExpectSyncedAndDeleted(); | 5569 ExpectSyncedAndDeleted(); |
| 5577 | 5570 |
| 5578 // Now, encounter a GetUpdates corresponding to the just-committed | 5571 // Now, encounter a GetUpdates corresponding to the just-committed |
| 5579 // deletion update. Should be consistent. | 5572 // deletion update. Should be consistent. |
| 5580 mock_server_->AddUpdateFromLastCommit(); | 5573 mock_server_->AddUpdateFromLastCommit(); |
| 5581 EXPECT_TRUE(SyncShareNudge()); | 5574 EXPECT_TRUE(SyncShareNudge()); |
| 5582 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5575 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5583 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5576 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5584 ExpectSyncedAndDeleted(); | 5577 ExpectSyncedAndDeleted(); |
| 5585 | 5578 |
| 5586 // After the GetUpdates, the item is locally undeleted. | 5579 // After the GetUpdates, the item is locally undeleted. |
| 5587 Undelete(); | 5580 Undelete(); |
| 5588 ExpectUnsyncedUndeletion(); | 5581 ExpectUnsyncedUndeletion(); |
| 5589 | 5582 |
| 5590 // Now, encounter a GetUpdates corresponding to the just-committed | 5583 // Now, encounter a GetUpdates corresponding to the just-committed |
| 5591 // deletion update. The undeletion should prevail. | 5584 // deletion update. The undeletion should prevail. |
| 5592 EXPECT_TRUE(SyncShareNudge()); | 5585 EXPECT_TRUE(SyncShareNudge()); |
| 5593 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5586 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5594 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5587 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5595 ExpectSyncedAndCreated(); | 5588 ExpectSyncedAndCreated(); |
| 5596 } | 5589 } |
| 5597 | 5590 |
| 5598 // Test processing of undeletion GetUpdateses. | 5591 // Test processing of undeletion GetUpdateses. |
| 5599 TEST_F(SyncerUndeletionTest, UndeleteAfterOtherClientDeletes) { | 5592 TEST_F(SyncerUndeletionTest, UndeleteAfterOtherClientDeletes) { |
| 5600 Create(); | 5593 Create(); |
| 5601 ExpectUnsyncedCreation(); | 5594 ExpectUnsyncedCreation(); |
| 5602 EXPECT_TRUE(SyncShareNudge()); | 5595 EXPECT_TRUE(SyncShareNudge()); |
| 5603 | 5596 |
| 5604 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5597 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5605 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5598 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5606 ExpectSyncedAndCreated(); | 5599 ExpectSyncedAndCreated(); |
| 5607 | 5600 |
| 5608 // Add a delete from the server. | 5601 // Add a delete from the server. |
| 5609 sync_pb::SyncEntity* update1 = mock_server_->AddUpdateFromLastCommit(); | 5602 sync_pb::SyncEntity* update1 = mock_server_->AddUpdateFromLastCommit(); |
| 5610 update1->set_originator_cache_guid(local_cache_guid()); | 5603 update1->set_originator_cache_guid(local_cache_guid()); |
| 5611 update1->set_originator_client_item_id(local_id_.GetServerId()); | 5604 update1->set_originator_client_item_id(local_id_.GetServerId()); |
| 5612 EXPECT_TRUE(SyncShareNudge()); | 5605 EXPECT_TRUE(SyncShareNudge()); |
| 5613 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5606 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5614 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5607 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5615 ExpectSyncedAndCreated(); | 5608 ExpectSyncedAndCreated(); |
| 5616 | 5609 |
| 5617 // Some other client deletes the item. | 5610 // Some other client deletes the item. |
| 5618 { | 5611 { |
| 5619 syncable::ReadTransaction trans(FROM_HERE, directory()); | 5612 syncable::ReadTransaction trans(FROM_HERE, directory()); |
| 5620 Entry entry(&trans, GET_BY_HANDLE, metahandle_); | 5613 Entry entry(&trans, GET_BY_HANDLE, metahandle_); |
| 5621 mock_server_->AddUpdateTombstone(entry.GetId(), PREFERENCES); | 5614 mock_server_->AddUpdateTombstone(entry.GetId(), PREFERENCES); |
| 5622 } | 5615 } |
| 5623 EXPECT_TRUE(SyncShareNudge()); | 5616 EXPECT_TRUE(SyncShareNudge()); |
| 5624 | 5617 |
| 5625 // The update ought to have applied successfully. | 5618 // The update ought to have applied successfully. |
| 5626 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5619 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5627 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5620 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5628 ExpectSyncedAndDeleted(); | 5621 ExpectSyncedAndDeleted(); |
| 5629 | 5622 |
| 5630 // Undelete it locally. | 5623 // Undelete it locally. |
| 5631 Undelete(); | 5624 Undelete(); |
| 5632 ExpectUnsyncedUndeletion(); | 5625 ExpectUnsyncedUndeletion(); |
| 5633 EXPECT_TRUE(SyncShareNudge()); | 5626 EXPECT_TRUE(SyncShareNudge()); |
| 5634 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5627 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5635 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5628 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5636 ExpectSyncedAndCreated(); | 5629 ExpectSyncedAndCreated(); |
| 5637 | 5630 |
| 5638 // Now, encounter a GetUpdates corresponding to the just-committed | 5631 // Now, encounter a GetUpdates corresponding to the just-committed |
| 5639 // deletion update. The undeletion should prevail. | 5632 // deletion update. The undeletion should prevail. |
| 5640 sync_pb::SyncEntity* update2 = mock_server_->AddUpdateFromLastCommit(); | 5633 sync_pb::SyncEntity* update2 = mock_server_->AddUpdateFromLastCommit(); |
| 5641 update2->set_originator_cache_guid(local_cache_guid()); | 5634 update2->set_originator_cache_guid(local_cache_guid()); |
| 5642 update2->set_originator_client_item_id(local_id_.GetServerId()); | 5635 update2->set_originator_client_item_id(local_id_.GetServerId()); |
| 5643 EXPECT_TRUE(SyncShareNudge()); | 5636 EXPECT_TRUE(SyncShareNudge()); |
| 5644 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5637 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5645 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5638 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5646 ExpectSyncedAndCreated(); | 5639 ExpectSyncedAndCreated(); |
| 5647 } | 5640 } |
| 5648 | 5641 |
| 5649 TEST_F(SyncerUndeletionTest, UndeleteAfterOtherClientDeletesImmediately) { | 5642 TEST_F(SyncerUndeletionTest, UndeleteAfterOtherClientDeletesImmediately) { |
| 5650 Create(); | 5643 Create(); |
| 5651 ExpectUnsyncedCreation(); | 5644 ExpectUnsyncedCreation(); |
| 5652 EXPECT_TRUE(SyncShareNudge()); | 5645 EXPECT_TRUE(SyncShareNudge()); |
| 5653 | 5646 |
| 5654 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5647 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5655 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5648 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5656 ExpectSyncedAndCreated(); | 5649 ExpectSyncedAndCreated(); |
| 5657 | 5650 |
| 5658 // Some other client deletes the item before we get a chance | 5651 // Some other client deletes the item before we get a chance |
| 5659 // to GetUpdates our original request. | 5652 // to GetUpdates our original request. |
| 5660 { | 5653 { |
| 5661 syncable::ReadTransaction trans(FROM_HERE, directory()); | 5654 syncable::ReadTransaction trans(FROM_HERE, directory()); |
| 5662 Entry entry(&trans, GET_BY_HANDLE, metahandle_); | 5655 Entry entry(&trans, GET_BY_HANDLE, metahandle_); |
| 5663 mock_server_->AddUpdateTombstone(entry.GetId(), PREFERENCES); | 5656 mock_server_->AddUpdateTombstone(entry.GetId(), PREFERENCES); |
| 5664 } | 5657 } |
| 5665 EXPECT_TRUE(SyncShareNudge()); | 5658 EXPECT_TRUE(SyncShareNudge()); |
| 5666 | 5659 |
| 5667 // The update ought to have applied successfully. | 5660 // The update ought to have applied successfully. |
| 5668 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5661 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5669 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5662 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5670 ExpectSyncedAndDeleted(); | 5663 ExpectSyncedAndDeleted(); |
| 5671 | 5664 |
| 5672 // Undelete it locally. | 5665 // Undelete it locally. |
| 5673 Undelete(); | 5666 Undelete(); |
| 5674 ExpectUnsyncedUndeletion(); | 5667 ExpectUnsyncedUndeletion(); |
| 5675 EXPECT_TRUE(SyncShareNudge()); | 5668 EXPECT_TRUE(SyncShareNudge()); |
| 5676 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5669 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5677 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5670 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5678 ExpectSyncedAndCreated(); | 5671 ExpectSyncedAndCreated(); |
| 5679 | 5672 |
| 5680 // Now, encounter a GetUpdates corresponding to the just-committed | 5673 // Now, encounter a GetUpdates corresponding to the just-committed |
| 5681 // deletion update. The undeletion should prevail. | 5674 // deletion update. The undeletion should prevail. |
| 5682 sync_pb::SyncEntity* update = mock_server_->AddUpdateFromLastCommit(); | 5675 sync_pb::SyncEntity* update = mock_server_->AddUpdateFromLastCommit(); |
| 5683 update->set_originator_cache_guid(local_cache_guid()); | 5676 update->set_originator_cache_guid(local_cache_guid()); |
| 5684 update->set_originator_client_item_id(local_id_.GetServerId()); | 5677 update->set_originator_client_item_id(local_id_.GetServerId()); |
| 5685 EXPECT_TRUE(SyncShareNudge()); | 5678 EXPECT_TRUE(SyncShareNudge()); |
| 5686 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5679 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5687 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5680 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5688 ExpectSyncedAndCreated(); | 5681 ExpectSyncedAndCreated(); |
| 5689 } | 5682 } |
| 5690 | 5683 |
| 5691 TEST_F(SyncerUndeletionTest, OtherClientUndeletes) { | 5684 TEST_F(SyncerUndeletionTest, OtherClientUndeletes) { |
| 5692 Create(); | 5685 Create(); |
| 5693 ExpectUnsyncedCreation(); | 5686 ExpectUnsyncedCreation(); |
| 5694 EXPECT_TRUE(SyncShareNudge()); | 5687 EXPECT_TRUE(SyncShareNudge()); |
| 5695 | 5688 |
| 5696 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5689 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5697 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5690 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5698 ExpectSyncedAndCreated(); | 5691 ExpectSyncedAndCreated(); |
| 5699 | 5692 |
| 5700 // Get the updates of our just-committed entry. | 5693 // Get the updates of our just-committed entry. |
| 5701 sync_pb::SyncEntity* update = mock_server_->AddUpdateFromLastCommit(); | 5694 sync_pb::SyncEntity* update = mock_server_->AddUpdateFromLastCommit(); |
| 5702 update->set_originator_cache_guid(local_cache_guid()); | 5695 update->set_originator_cache_guid(local_cache_guid()); |
| 5703 update->set_originator_client_item_id(local_id_.GetServerId()); | 5696 update->set_originator_client_item_id(local_id_.GetServerId()); |
| 5704 EXPECT_TRUE(SyncShareNudge()); | 5697 EXPECT_TRUE(SyncShareNudge()); |
| 5705 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5698 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5706 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5699 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5707 ExpectSyncedAndCreated(); | 5700 ExpectSyncedAndCreated(); |
| 5708 | 5701 |
| 5709 // We delete the item. | 5702 // We delete the item. |
| 5710 Delete(); | 5703 Delete(); |
| 5711 ExpectUnsyncedDeletion(); | 5704 ExpectUnsyncedDeletion(); |
| 5712 EXPECT_TRUE(SyncShareNudge()); | 5705 EXPECT_TRUE(SyncShareNudge()); |
| 5713 | 5706 |
| 5714 // The update ought to have applied successfully. | 5707 // The update ought to have applied successfully. |
| 5715 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5708 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5716 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5709 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5717 ExpectSyncedAndDeleted(); | 5710 ExpectSyncedAndDeleted(); |
| 5718 | 5711 |
| 5719 // Now, encounter a GetUpdates corresponding to the just-committed | 5712 // Now, encounter a GetUpdates corresponding to the just-committed |
| 5720 // deletion update. | 5713 // deletion update. |
| 5721 mock_server_->AddUpdateFromLastCommit(); | 5714 mock_server_->AddUpdateFromLastCommit(); |
| 5722 EXPECT_TRUE(SyncShareNudge()); | 5715 EXPECT_TRUE(SyncShareNudge()); |
| 5723 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5716 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5724 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5717 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5725 ExpectSyncedAndDeleted(); | 5718 ExpectSyncedAndDeleted(); |
| 5726 | 5719 |
| 5727 // Some other client undeletes the item. | 5720 // Some other client undeletes the item. |
| 5728 { | 5721 { |
| 5729 syncable::ReadTransaction trans(FROM_HERE, directory()); | 5722 syncable::ReadTransaction trans(FROM_HERE, directory()); |
| 5730 Entry entry(&trans, GET_BY_HANDLE, metahandle_); | 5723 Entry entry(&trans, GET_BY_HANDLE, metahandle_); |
| 5731 mock_server_->AddUpdatePref(entry.GetId().GetServerId(), | 5724 mock_server_->AddUpdatePref(entry.GetId().GetServerId(), |
| 5732 entry.GetParentId().GetServerId(), client_tag_, | 5725 entry.GetParentId().GetServerId(), client_tag_, |
| 5733 100, 1000); | 5726 100, 1000); |
| 5734 } | 5727 } |
| 5735 mock_server_->SetLastUpdateClientTag(client_tag_); | 5728 mock_server_->SetLastUpdateClientTag(client_tag_); |
| 5736 EXPECT_TRUE(SyncShareNudge()); | 5729 EXPECT_TRUE(SyncShareNudge()); |
| 5737 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5730 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5738 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5731 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5739 ExpectSyncedAndCreated(); | 5732 ExpectSyncedAndCreated(); |
| 5740 } | 5733 } |
| 5741 | 5734 |
| 5742 TEST_F(SyncerUndeletionTest, OtherClientUndeletesImmediately) { | 5735 TEST_F(SyncerUndeletionTest, OtherClientUndeletesImmediately) { |
| 5743 Create(); | 5736 Create(); |
| 5744 ExpectUnsyncedCreation(); | 5737 ExpectUnsyncedCreation(); |
| 5745 EXPECT_TRUE(SyncShareNudge()); | 5738 EXPECT_TRUE(SyncShareNudge()); |
| 5746 | 5739 |
| 5747 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5740 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5748 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5741 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5749 ExpectSyncedAndCreated(); | 5742 ExpectSyncedAndCreated(); |
| 5750 | 5743 |
| 5751 // Get the updates of our just-committed entry. | 5744 // Get the updates of our just-committed entry. |
| 5752 sync_pb::SyncEntity* update = mock_server_->AddUpdateFromLastCommit(); | 5745 sync_pb::SyncEntity* update = mock_server_->AddUpdateFromLastCommit(); |
| 5753 update->set_originator_cache_guid(local_cache_guid()); | 5746 update->set_originator_cache_guid(local_cache_guid()); |
| 5754 { | 5747 { |
| 5755 syncable::ReadTransaction trans(FROM_HERE, directory()); | 5748 syncable::ReadTransaction trans(FROM_HERE, directory()); |
| 5756 Entry entry(&trans, GET_BY_HANDLE, metahandle_); | 5749 Entry entry(&trans, GET_BY_HANDLE, metahandle_); |
| 5757 update->set_originator_client_item_id(local_id_.GetServerId()); | 5750 update->set_originator_client_item_id(local_id_.GetServerId()); |
| 5758 } | 5751 } |
| 5759 EXPECT_TRUE(SyncShareNudge()); | 5752 EXPECT_TRUE(SyncShareNudge()); |
| 5760 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5753 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5761 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5754 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5762 ExpectSyncedAndCreated(); | 5755 ExpectSyncedAndCreated(); |
| 5763 | 5756 |
| 5764 // We delete the item. | 5757 // We delete the item. |
| 5765 Delete(); | 5758 Delete(); |
| 5766 ExpectUnsyncedDeletion(); | 5759 ExpectUnsyncedDeletion(); |
| 5767 EXPECT_TRUE(SyncShareNudge()); | 5760 EXPECT_TRUE(SyncShareNudge()); |
| 5768 | 5761 |
| 5769 // The update ought to have applied successfully. | 5762 // The update ought to have applied successfully. |
| 5770 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5763 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5771 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5764 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5772 ExpectSyncedAndDeleted(); | 5765 ExpectSyncedAndDeleted(); |
| 5773 | 5766 |
| 5774 // Some other client undeletes before we see the update from our | 5767 // Some other client undeletes before we see the update from our |
| 5775 // commit. | 5768 // commit. |
| 5776 { | 5769 { |
| 5777 syncable::ReadTransaction trans(FROM_HERE, directory()); | 5770 syncable::ReadTransaction trans(FROM_HERE, directory()); |
| 5778 Entry entry(&trans, GET_BY_HANDLE, metahandle_); | 5771 Entry entry(&trans, GET_BY_HANDLE, metahandle_); |
| 5779 mock_server_->AddUpdatePref(entry.GetId().GetServerId(), | 5772 mock_server_->AddUpdatePref(entry.GetId().GetServerId(), |
| 5780 entry.GetParentId().GetServerId(), client_tag_, | 5773 entry.GetParentId().GetServerId(), client_tag_, |
| 5781 100, 1000); | 5774 100, 1000); |
| 5782 } | 5775 } |
| 5783 mock_server_->SetLastUpdateClientTag(client_tag_); | 5776 mock_server_->SetLastUpdateClientTag(client_tag_); |
| 5784 EXPECT_TRUE(SyncShareNudge()); | 5777 EXPECT_TRUE(SyncShareNudge()); |
| 5785 EXPECT_EQ(0, session_->status_controller().TotalNumConflictingItems()); | 5778 EXPECT_EQ(0, cycle_->status_controller().TotalNumConflictingItems()); |
| 5786 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); | 5779 EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); |
| 5787 ExpectSyncedAndCreated(); | 5780 ExpectSyncedAndCreated(); |
| 5788 } | 5781 } |
| 5789 | 5782 |
| 5790 enum { | 5783 enum { |
| 5791 TEST_PARAM_BOOKMARK_ENABLE_BIT, | 5784 TEST_PARAM_BOOKMARK_ENABLE_BIT, |
| 5792 TEST_PARAM_AUTOFILL_ENABLE_BIT, | 5785 TEST_PARAM_AUTOFILL_ENABLE_BIT, |
| 5793 TEST_PARAM_BIT_COUNT | 5786 TEST_PARAM_BIT_COUNT |
| 5794 }; | 5787 }; |
| 5795 | 5788 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5852 EXPECT_EQ("xyz", final_monitor_records["xyz"].extension_id); | 5845 EXPECT_EQ("xyz", final_monitor_records["xyz"].extension_id); |
| 5853 EXPECT_EQ(2049U, final_monitor_records["ABC"].bookmark_write_count); | 5846 EXPECT_EQ(2049U, final_monitor_records["ABC"].bookmark_write_count); |
| 5854 EXPECT_EQ(4U, final_monitor_records["xyz"].bookmark_write_count); | 5847 EXPECT_EQ(4U, final_monitor_records["xyz"].bookmark_write_count); |
| 5855 } else { | 5848 } else { |
| 5856 EXPECT_TRUE(final_monitor_records.empty()) | 5849 EXPECT_TRUE(final_monitor_records.empty()) |
| 5857 << "Should not restore records after successful bookmark commit."; | 5850 << "Should not restore records after successful bookmark commit."; |
| 5858 } | 5851 } |
| 5859 } | 5852 } |
| 5860 | 5853 |
| 5861 } // namespace syncer | 5854 } // namespace syncer |
| OLD | NEW |