| 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 29 matching lines...) Expand all Loading... |
| 40 #include "sync/protocol/sync.pb.h" | 40 #include "sync/protocol/sync.pb.h" |
| 41 #include "sync/sessions/sync_session_context.h" | 41 #include "sync/sessions/sync_session_context.h" |
| 42 #include "sync/syncable/mutable_entry.h" | 42 #include "sync/syncable/mutable_entry.h" |
| 43 #include "sync/syncable/nigori_util.h" | 43 #include "sync/syncable/nigori_util.h" |
| 44 #include "sync/syncable/syncable_delete_journal.h" | 44 #include "sync/syncable/syncable_delete_journal.h" |
| 45 #include "sync/syncable/syncable_read_transaction.h" | 45 #include "sync/syncable/syncable_read_transaction.h" |
| 46 #include "sync/syncable/syncable_util.h" | 46 #include "sync/syncable/syncable_util.h" |
| 47 #include "sync/syncable/syncable_write_transaction.h" | 47 #include "sync/syncable/syncable_write_transaction.h" |
| 48 #include "sync/test/engine/fake_model_worker.h" | 48 #include "sync/test/engine/fake_model_worker.h" |
| 49 #include "sync/test/engine/mock_connection_manager.h" | 49 #include "sync/test/engine/mock_connection_manager.h" |
| 50 #include "sync/test/engine/mock_nudge_handler.h" |
| 50 #include "sync/test/engine/test_directory_setter_upper.h" | 51 #include "sync/test/engine/test_directory_setter_upper.h" |
| 51 #include "sync/test/engine/test_id_factory.h" | 52 #include "sync/test/engine/test_id_factory.h" |
| 52 #include "sync/test/engine/test_syncable_utils.h" | 53 #include "sync/test/engine/test_syncable_utils.h" |
| 53 #include "sync/test/fake_encryptor.h" | 54 #include "sync/test/fake_encryptor.h" |
| 54 #include "sync/test/fake_sync_encryption_handler.h" | 55 #include "sync/test/fake_sync_encryption_handler.h" |
| 55 #include "sync/test/sessions/mock_debug_info_getter.h" | 56 #include "sync/test/sessions/mock_debug_info_getter.h" |
| 56 #include "sync/util/cryptographer.h" | 57 #include "sync/util/cryptographer.h" |
| 57 #include "sync/util/extensions_activity.h" | 58 #include "sync/util/extensions_activity.h" |
| 58 #include "sync/util/time.h" | 59 #include "sync/util/time.h" |
| 59 #include "testing/gtest/include/gtest/gtest.h" | 60 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 EnableDatatype(PREFERENCES); | 288 EnableDatatype(PREFERENCES); |
| 288 EnableDatatype(NIGORI); | 289 EnableDatatype(NIGORI); |
| 289 workers_.push_back(scoped_refptr<ModelSafeWorker>( | 290 workers_.push_back(scoped_refptr<ModelSafeWorker>( |
| 290 new FakeModelWorker(GROUP_PASSIVE))); | 291 new FakeModelWorker(GROUP_PASSIVE))); |
| 291 std::vector<SyncEngineEventListener*> listeners; | 292 std::vector<SyncEngineEventListener*> listeners; |
| 292 listeners.push_back(this); | 293 listeners.push_back(this); |
| 293 | 294 |
| 294 ModelSafeRoutingInfo routing_info; | 295 ModelSafeRoutingInfo routing_info; |
| 295 GetModelSafeRoutingInfo(&routing_info); | 296 GetModelSafeRoutingInfo(&routing_info); |
| 296 | 297 |
| 297 model_type_registry_.reset(new ModelTypeRegistry(workers_, directory())); | 298 model_type_registry_.reset( |
| 299 new ModelTypeRegistry(workers_, directory(), &mock_nudge_handler_)); |
| 298 model_type_registry_->RegisterDirectoryTypeDebugInfoObserver( | 300 model_type_registry_->RegisterDirectoryTypeDebugInfoObserver( |
| 299 &debug_info_cache_); | 301 &debug_info_cache_); |
| 300 | 302 |
| 301 context_.reset( | 303 context_.reset( |
| 302 new SyncSessionContext( | 304 new SyncSessionContext( |
| 303 mock_server_.get(), directory(), | 305 mock_server_.get(), directory(), |
| 304 extensions_activity_, | 306 extensions_activity_, |
| 305 listeners, debug_info_getter_.get(), | 307 listeners, debug_info_getter_.get(), |
| 306 model_type_registry_.get(), | 308 model_type_registry_.get(), |
| 307 true, // enable keystore encryption | 309 true, // enable keystore encryption |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 TestDirectorySetterUpper dir_maker_; | 579 TestDirectorySetterUpper dir_maker_; |
| 578 FakeEncryptor encryptor_; | 580 FakeEncryptor encryptor_; |
| 579 scoped_refptr<ExtensionsActivity> extensions_activity_; | 581 scoped_refptr<ExtensionsActivity> extensions_activity_; |
| 580 scoped_ptr<MockConnectionManager> mock_server_; | 582 scoped_ptr<MockConnectionManager> mock_server_; |
| 581 CancelationSignal cancelation_signal_; | 583 CancelationSignal cancelation_signal_; |
| 582 | 584 |
| 583 Syncer* syncer_; | 585 Syncer* syncer_; |
| 584 | 586 |
| 585 scoped_ptr<SyncSession> session_; | 587 scoped_ptr<SyncSession> session_; |
| 586 TypeDebugInfoCache debug_info_cache_; | 588 TypeDebugInfoCache debug_info_cache_; |
| 589 MockNudgeHandler mock_nudge_handler_; |
| 587 scoped_ptr<ModelTypeRegistry> model_type_registry_; | 590 scoped_ptr<ModelTypeRegistry> model_type_registry_; |
| 588 scoped_ptr<SyncSessionContext> context_; | 591 scoped_ptr<SyncSessionContext> context_; |
| 589 bool saw_syncer_event_; | 592 bool saw_syncer_event_; |
| 590 base::TimeDelta last_short_poll_interval_received_; | 593 base::TimeDelta last_short_poll_interval_received_; |
| 591 base::TimeDelta last_long_poll_interval_received_; | 594 base::TimeDelta last_long_poll_interval_received_; |
| 592 base::TimeDelta last_sessions_commit_delay_seconds_; | 595 base::TimeDelta last_sessions_commit_delay_seconds_; |
| 593 int last_client_invalidation_hint_buffer_size_; | 596 int last_client_invalidation_hint_buffer_size_; |
| 594 std::vector<scoped_refptr<ModelSafeWorker> > workers_; | 597 std::vector<scoped_refptr<ModelSafeWorker> > workers_; |
| 595 | 598 |
| 596 ModelTypeSet enabled_datatypes_; | 599 ModelTypeSet enabled_datatypes_; |
| (...skipping 4365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4962 EXPECT_EQ("xyz", final_monitor_records["xyz"].extension_id); | 4965 EXPECT_EQ("xyz", final_monitor_records["xyz"].extension_id); |
| 4963 EXPECT_EQ(2049U, final_monitor_records["ABC"].bookmark_write_count); | 4966 EXPECT_EQ(2049U, final_monitor_records["ABC"].bookmark_write_count); |
| 4964 EXPECT_EQ(4U, final_monitor_records["xyz"].bookmark_write_count); | 4967 EXPECT_EQ(4U, final_monitor_records["xyz"].bookmark_write_count); |
| 4965 } else { | 4968 } else { |
| 4966 EXPECT_TRUE(final_monitor_records.empty()) | 4969 EXPECT_TRUE(final_monitor_records.empty()) |
| 4967 << "Should not restore records after successful bookmark commit."; | 4970 << "Should not restore records after successful bookmark commit."; |
| 4968 } | 4971 } |
| 4969 } | 4972 } |
| 4970 | 4973 |
| 4971 } // namespace syncer | 4974 } // namespace syncer |
| OLD | NEW |