Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: sync/engine/directory_update_handler_unittest.cc

Issue 1393633003: Sync: fix for the code that checks whether the initial download has completed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed CR feedback Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sync/engine/directory_update_handler.cc ('k') | sync/engine/syncer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « sync/engine/directory_update_handler.cc ('k') | sync/engine/syncer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698