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/containers/scoped_ptr_map.h" | 8 #include "base/containers/scoped_ptr_map.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } | 79 } |
80 | 80 |
81 bool EntryExists(const std::string& id) { | 81 bool EntryExists(const std::string& id) { |
82 syncable::ReadTransaction trans(FROM_HERE, dir()); | 82 syncable::ReadTransaction trans(FROM_HERE, dir()); |
83 syncable::Entry e(&trans, syncable::GET_BY_ID, | 83 syncable::Entry e(&trans, syncable::GET_BY_ID, |
84 Id::CreateFromServerId(id)); | 84 Id::CreateFromServerId(id)); |
85 return e.good() && !e.GetIsDel(); | 85 return e.good() && !e.GetIsDel(); |
86 } | 86 } |
87 | 87 |
88 bool TypeRootExists(ModelType model_type) { | 88 bool TypeRootExists(ModelType model_type) { |
89 syncable::ReadTransaction trans(FROM_HERE, dir()); | 89 return dir()->InitialSyncEndedForType(model_type); |
90 syncable::Entry e(&trans, syncable::GET_TYPE_ROOT, model_type); | |
91 return e.good() && !e.GetIsDel(); | |
92 } | 90 } |
93 | 91 |
94 protected: | 92 protected: |
95 // Used in the construction of DirectoryTypeDebugInfoEmitters. | 93 // Used in the construction of DirectoryTypeDebugInfoEmitters. |
96 base::ObserverList<TypeDebugInfoObserver> type_observers_; | 94 base::ObserverList<TypeDebugInfoObserver> type_observers_; |
97 | 95 |
98 private: | 96 private: |
99 base::MessageLoop loop_; // Needed to initialize the directory. | 97 base::MessageLoop loop_; // Needed to initialize the directory. |
100 TestDirectorySetterUpper dir_maker_; | 98 TestDirectorySetterUpper dir_maker_; |
101 scoped_refptr<FakeModelWorker> ui_worker_; | 99 scoped_refptr<FakeModelWorker> ui_worker_; |
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 const UpdateCounters& counters = GetArticlesUpdateCounters(); | 1148 const UpdateCounters& counters = GetArticlesUpdateCounters(); |
1151 EXPECT_EQ(1, counters.num_updates_applied); | 1149 EXPECT_EQ(1, counters.num_updates_applied); |
1152 EXPECT_EQ(1, counters.num_local_overwrites); | 1150 EXPECT_EQ(1, counters.num_local_overwrites); |
1153 EXPECT_EQ(0, counters.num_server_overwrites); | 1151 EXPECT_EQ(0, counters.num_server_overwrites); |
1154 local_metadata = entry_factory()->GetLocalAttachmentMetadataForItem(handle); | 1152 local_metadata = entry_factory()->GetLocalAttachmentMetadataForItem(handle); |
1155 EXPECT_EQ(server_metadata.SerializeAsString(), | 1153 EXPECT_EQ(server_metadata.SerializeAsString(), |
1156 local_metadata.SerializeAsString()); | 1154 local_metadata.SerializeAsString()); |
1157 } | 1155 } |
1158 | 1156 |
1159 } // namespace syncer | 1157 } // namespace syncer |
OLD | NEW |