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 12 matching lines...) Expand all Loading... |
23 #include "base/strings/stringprintf.h" | 23 #include "base/strings/stringprintf.h" |
24 #include "base/time/time.h" | 24 #include "base/time/time.h" |
25 #include "build/build_config.h" | 25 #include "build/build_config.h" |
26 #include "sync/engine/get_commit_ids_command.h" | 26 #include "sync/engine/get_commit_ids_command.h" |
27 #include "sync/engine/net/server_connection_manager.h" | 27 #include "sync/engine/net/server_connection_manager.h" |
28 #include "sync/engine/process_updates_command.h" | 28 #include "sync/engine/process_updates_command.h" |
29 #include "sync/engine/sync_scheduler_impl.h" | 29 #include "sync/engine/sync_scheduler_impl.h" |
30 #include "sync/engine/syncer.h" | 30 #include "sync/engine/syncer.h" |
31 #include "sync/engine/syncer_proto_util.h" | 31 #include "sync/engine/syncer_proto_util.h" |
32 #include "sync/engine/traffic_recorder.h" | 32 #include "sync/engine/traffic_recorder.h" |
33 #include "sync/internal_api/public/base/cancelation_signal.h" | |
34 #include "sync/internal_api/public/base/model_type.h" | 33 #include "sync/internal_api/public/base/model_type.h" |
35 #include "sync/internal_api/public/engine/model_safe_worker.h" | 34 #include "sync/internal_api/public/engine/model_safe_worker.h" |
36 #include "sync/protocol/bookmark_specifics.pb.h" | 35 #include "sync/protocol/bookmark_specifics.pb.h" |
37 #include "sync/protocol/nigori_specifics.pb.h" | 36 #include "sync/protocol/nigori_specifics.pb.h" |
38 #include "sync/protocol/preference_specifics.pb.h" | 37 #include "sync/protocol/preference_specifics.pb.h" |
39 #include "sync/protocol/sync.pb.h" | 38 #include "sync/protocol/sync.pb.h" |
40 #include "sync/sessions/sync_session_context.h" | 39 #include "sync/sessions/sync_session_context.h" |
41 #include "sync/syncable/mutable_entry.h" | 40 #include "sync/syncable/mutable_entry.h" |
42 #include "sync/syncable/nigori_util.h" | 41 #include "sync/syncable/nigori_util.h" |
43 #include "sync/syncable/syncable_delete_journal.h" | 42 #include "sync/syncable/syncable_delete_journal.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 221 |
223 context_.reset( | 222 context_.reset( |
224 new SyncSessionContext( | 223 new SyncSessionContext( |
225 mock_server_.get(), directory(), workers, | 224 mock_server_.get(), directory(), workers, |
226 extensions_activity_, | 225 extensions_activity_, |
227 listeners, NULL, &traffic_recorder_, | 226 listeners, NULL, &traffic_recorder_, |
228 true, // enable keystore encryption | 227 true, // enable keystore encryption |
229 false, // force enable pre-commit GU avoidance experiment | 228 false, // force enable pre-commit GU avoidance experiment |
230 "fake_invalidator_client_id")); | 229 "fake_invalidator_client_id")); |
231 context_->set_routing_info(routing_info); | 230 context_->set_routing_info(routing_info); |
232 syncer_ = new Syncer(&cancelation_signal_); | 231 syncer_ = new Syncer(); |
233 | 232 |
234 syncable::ReadTransaction trans(FROM_HERE, directory()); | 233 syncable::ReadTransaction trans(FROM_HERE, directory()); |
235 syncable::Directory::Metahandles children; | 234 syncable::Directory::Metahandles children; |
236 directory()->GetChildHandlesById(&trans, trans.root_id(), &children); | 235 directory()->GetChildHandlesById(&trans, trans.root_id(), &children); |
237 ASSERT_EQ(0u, children.size()); | 236 ASSERT_EQ(0u, children.size()); |
238 saw_syncer_event_ = false; | 237 saw_syncer_event_ = false; |
239 root_id_ = TestIdFactory::root(); | 238 root_id_ = TestIdFactory::root(); |
240 parent_id_ = ids_.MakeServer("parent id"); | 239 parent_id_ = ids_.MakeServer("parent id"); |
241 child_id_ = ids_.MakeServer("child id"); | 240 child_id_ = ids_.MakeServer("child id"); |
242 directory()->set_store_birthday(mock_server_->store_birthday()); | 241 directory()->set_store_birthday(mock_server_->store_birthday()); |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 syncable::Id root_id_; | 544 syncable::Id root_id_; |
546 syncable::Id parent_id_; | 545 syncable::Id parent_id_; |
547 syncable::Id child_id_; | 546 syncable::Id child_id_; |
548 | 547 |
549 TestIdFactory ids_; | 548 TestIdFactory ids_; |
550 | 549 |
551 TestDirectorySetterUpper dir_maker_; | 550 TestDirectorySetterUpper dir_maker_; |
552 FakeEncryptor encryptor_; | 551 FakeEncryptor encryptor_; |
553 scoped_refptr<ExtensionsActivity> extensions_activity_; | 552 scoped_refptr<ExtensionsActivity> extensions_activity_; |
554 scoped_ptr<MockConnectionManager> mock_server_; | 553 scoped_ptr<MockConnectionManager> mock_server_; |
555 CancelationSignal cancelation_signal_; | |
556 | 554 |
557 Syncer* syncer_; | 555 Syncer* syncer_; |
558 | 556 |
559 scoped_ptr<SyncSession> session_; | 557 scoped_ptr<SyncSession> session_; |
560 scoped_ptr<SyncSessionContext> context_; | 558 scoped_ptr<SyncSessionContext> context_; |
561 bool saw_syncer_event_; | 559 bool saw_syncer_event_; |
562 base::TimeDelta last_short_poll_interval_received_; | 560 base::TimeDelta last_short_poll_interval_received_; |
563 base::TimeDelta last_long_poll_interval_received_; | 561 base::TimeDelta last_long_poll_interval_received_; |
564 base::TimeDelta last_sessions_commit_delay_seconds_; | 562 base::TimeDelta last_sessions_commit_delay_seconds_; |
565 int last_client_invalidation_hint_buffer_size_; | 563 int last_client_invalidation_hint_buffer_size_; |
(...skipping 4242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4808 EXPECT_EQ("xyz", final_monitor_records["xyz"].extension_id); | 4806 EXPECT_EQ("xyz", final_monitor_records["xyz"].extension_id); |
4809 EXPECT_EQ(2049U, final_monitor_records["ABC"].bookmark_write_count); | 4807 EXPECT_EQ(2049U, final_monitor_records["ABC"].bookmark_write_count); |
4810 EXPECT_EQ(4U, final_monitor_records["xyz"].bookmark_write_count); | 4808 EXPECT_EQ(4U, final_monitor_records["xyz"].bookmark_write_count); |
4811 } else { | 4809 } else { |
4812 EXPECT_TRUE(final_monitor_records.empty()) | 4810 EXPECT_TRUE(final_monitor_records.empty()) |
4813 << "Should not restore records after successful bookmark commit."; | 4811 << "Should not restore records after successful bookmark commit."; |
4814 } | 4812 } |
4815 } | 4813 } |
4816 | 4814 |
4817 } // namespace syncer | 4815 } // namespace syncer |
OLD | NEW |