OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "sync/engine/directory_update_handler.h" | 5 #include "sync/engine/directory_update_handler.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "sync/engine/syncer_proto_util.h" | 10 #include "sync/engine/syncer_proto_util.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } | 85 } |
86 | 86 |
87 bool TypeRootExists(ModelType model_type) { | 87 bool TypeRootExists(ModelType model_type) { |
88 syncable::ReadTransaction trans(FROM_HERE, dir()); | 88 syncable::ReadTransaction trans(FROM_HERE, dir()); |
89 syncable::Entry e(&trans, syncable::GET_TYPE_ROOT, model_type); | 89 syncable::Entry e(&trans, syncable::GET_TYPE_ROOT, model_type); |
90 return e.good() && !e.GetIsDel(); | 90 return e.good() && !e.GetIsDel(); |
91 } | 91 } |
92 | 92 |
93 protected: | 93 protected: |
94 // Used in the construction of DirectoryTypeDebugInfoEmitters. | 94 // Used in the construction of DirectoryTypeDebugInfoEmitters. |
95 ObserverList<TypeDebugInfoObserver> type_observers_; | 95 base::ObserverList<TypeDebugInfoObserver> type_observers_; |
96 | 96 |
97 private: | 97 private: |
98 base::MessageLoop loop_; // Needed to initialize the directory. | 98 base::MessageLoop loop_; // Needed to initialize the directory. |
99 TestDirectorySetterUpper dir_maker_; | 99 TestDirectorySetterUpper dir_maker_; |
100 scoped_refptr<FakeModelWorker> ui_worker_; | 100 scoped_refptr<FakeModelWorker> ui_worker_; |
101 }; | 101 }; |
102 | 102 |
103 scoped_ptr<sync_pb::SyncEntity> | 103 scoped_ptr<sync_pb::SyncEntity> |
104 DirectoryUpdateHandlerProcessUpdateTest::CreateUpdate( | 104 DirectoryUpdateHandlerProcessUpdateTest::CreateUpdate( |
105 const std::string& id, | 105 const std::string& id, |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 typedef std::map<ModelType, UpdateHandler*> UpdateHandlerMap; | 518 typedef std::map<ModelType, UpdateHandler*> UpdateHandlerMap; |
519 | 519 |
520 base::MessageLoop loop_; // Needed to initialize the directory. | 520 base::MessageLoop loop_; // Needed to initialize the directory. |
521 TestDirectorySetterUpper dir_maker_; | 521 TestDirectorySetterUpper dir_maker_; |
522 scoped_ptr<TestEntryFactory> entry_factory_; | 522 scoped_ptr<TestEntryFactory> entry_factory_; |
523 | 523 |
524 scoped_refptr<FakeModelWorker> ui_worker_; | 524 scoped_refptr<FakeModelWorker> ui_worker_; |
525 scoped_refptr<FakeModelWorker> password_worker_; | 525 scoped_refptr<FakeModelWorker> password_worker_; |
526 scoped_refptr<FakeModelWorker> passive_worker_; | 526 scoped_refptr<FakeModelWorker> passive_worker_; |
527 | 527 |
528 ObserverList<TypeDebugInfoObserver> type_observers_; | 528 base::ObserverList<TypeDebugInfoObserver> type_observers_; |
529 DirectoryTypeDebugInfoEmitter bookmarks_emitter_; | 529 DirectoryTypeDebugInfoEmitter bookmarks_emitter_; |
530 DirectoryTypeDebugInfoEmitter passwords_emitter_; | 530 DirectoryTypeDebugInfoEmitter passwords_emitter_; |
531 DirectoryTypeDebugInfoEmitter articles_emitter_; | 531 DirectoryTypeDebugInfoEmitter articles_emitter_; |
532 | 532 |
533 UpdateHandlerMap update_handler_map_; | 533 UpdateHandlerMap update_handler_map_; |
534 STLValueDeleter<UpdateHandlerMap> update_handler_map_deleter_; | 534 STLValueDeleter<UpdateHandlerMap> update_handler_map_deleter_; |
535 }; | 535 }; |
536 | 536 |
537 namespace { | 537 namespace { |
538 sync_pb::EntitySpecifics DefaultBookmarkSpecifics() { | 538 sync_pb::EntitySpecifics DefaultBookmarkSpecifics() { |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 const UpdateCounters& counters = GetArticlesUpdateCounters(); | 1156 const UpdateCounters& counters = GetArticlesUpdateCounters(); |
1157 EXPECT_EQ(1, counters.num_updates_applied); | 1157 EXPECT_EQ(1, counters.num_updates_applied); |
1158 EXPECT_EQ(1, counters.num_local_overwrites); | 1158 EXPECT_EQ(1, counters.num_local_overwrites); |
1159 EXPECT_EQ(0, counters.num_server_overwrites); | 1159 EXPECT_EQ(0, counters.num_server_overwrites); |
1160 local_metadata = entry_factory()->GetLocalAttachmentMetadataForItem(handle); | 1160 local_metadata = entry_factory()->GetLocalAttachmentMetadataForItem(handle); |
1161 EXPECT_EQ(server_metadata.SerializeAsString(), | 1161 EXPECT_EQ(server_metadata.SerializeAsString(), |
1162 local_metadata.SerializeAsString()); | 1162 local_metadata.SerializeAsString()); |
1163 } | 1163 } |
1164 | 1164 |
1165 } // namespace syncer | 1165 } // namespace syncer |
OLD | NEW |