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

Side by Side Diff: components/sync/engine_impl/syncer_unittest.cc

Issue 2388163002: [Sync] Move //components/sync to the syncer namespace, take 2. (Closed)
Patch Set: Rebase. Created 4 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
OLDNEW
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 "components/sync/engine_impl/syncer.h" 8 #include "components/sync/engine_impl/syncer.h"
9 9
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 class TypeDebugInfoCache : public TypeDebugInfoObserver { 102 class TypeDebugInfoCache : public TypeDebugInfoObserver {
103 public: 103 public:
104 TypeDebugInfoCache(); 104 TypeDebugInfoCache();
105 ~TypeDebugInfoCache() override; 105 ~TypeDebugInfoCache() override;
106 106
107 CommitCounters GetLatestCommitCounters(ModelType type) const; 107 CommitCounters GetLatestCommitCounters(ModelType type) const;
108 UpdateCounters GetLatestUpdateCounters(ModelType type) const; 108 UpdateCounters GetLatestUpdateCounters(ModelType type) const;
109 StatusCounters GetLatestStatusCounters(ModelType type) const; 109 StatusCounters GetLatestStatusCounters(ModelType type) const;
110 110
111 // TypeDebugInfoObserver implementation. 111 // TypeDebugInfoObserver implementation.
112 void OnCommitCountersUpdated(syncer::ModelType type, 112 void OnCommitCountersUpdated(ModelType type,
113 const CommitCounters& counters) override; 113 const CommitCounters& counters) override;
114 void OnUpdateCountersUpdated(syncer::ModelType type, 114 void OnUpdateCountersUpdated(ModelType type,
115 const UpdateCounters& counters) override; 115 const UpdateCounters& counters) override;
116 void OnStatusCountersUpdated(syncer::ModelType type, 116 void OnStatusCountersUpdated(ModelType type,
117 const StatusCounters& counters) override; 117 const StatusCounters& counters) override;
118 118
119 private: 119 private:
120 std::map<ModelType, CommitCounters> commit_counters_map_; 120 std::map<ModelType, CommitCounters> commit_counters_map_;
121 std::map<ModelType, UpdateCounters> update_counters_map_; 121 std::map<ModelType, UpdateCounters> update_counters_map_;
122 std::map<ModelType, StatusCounters> status_counters_map_; 122 std::map<ModelType, StatusCounters> status_counters_map_;
123 }; 123 };
124 124
125 TypeDebugInfoCache::TypeDebugInfoCache() {} 125 TypeDebugInfoCache::TypeDebugInfoCache() {}
126 126
(...skipping 26 matching lines...) Expand all
153 std::map<ModelType, StatusCounters>::const_iterator it = 153 std::map<ModelType, StatusCounters>::const_iterator it =
154 status_counters_map_.find(type); 154 status_counters_map_.find(type);
155 if (it == status_counters_map_.end()) { 155 if (it == status_counters_map_.end()) {
156 return StatusCounters(); 156 return StatusCounters();
157 } else { 157 } else {
158 return it->second; 158 return it->second;
159 } 159 }
160 } 160 }
161 161
162 void TypeDebugInfoCache::OnCommitCountersUpdated( 162 void TypeDebugInfoCache::OnCommitCountersUpdated(
163 syncer::ModelType type, 163 ModelType type,
164 const CommitCounters& counters) { 164 const CommitCounters& counters) {
165 commit_counters_map_[type] = counters; 165 commit_counters_map_[type] = counters;
166 } 166 }
167 167
168 void TypeDebugInfoCache::OnUpdateCountersUpdated( 168 void TypeDebugInfoCache::OnUpdateCountersUpdated(
169 syncer::ModelType type, 169 ModelType type,
170 const UpdateCounters& counters) { 170 const UpdateCounters& counters) {
171 update_counters_map_[type] = counters; 171 update_counters_map_[type] = counters;
172 } 172 }
173 173
174 void TypeDebugInfoCache::OnStatusCountersUpdated( 174 void TypeDebugInfoCache::OnStatusCountersUpdated(
175 syncer::ModelType type, 175 ModelType type,
176 const StatusCounters& counters) { 176 const StatusCounters& counters) {
177 status_counters_map_[type] = counters; 177 status_counters_map_[type] = counters;
178 } 178 }
179 179
180 } // namespace 180 } // namespace
181 181
182 class SyncerTest : public testing::Test, 182 class SyncerTest : public testing::Test,
183 public SyncCycle::Delegate, 183 public SyncCycle::Delegate,
184 public SyncEngineEventListener { 184 public SyncEngineEventListener {
185 protected: 185 protected:
(...skipping 5659 matching lines...) Expand 10 before | Expand all | Expand 10 after
5845 EXPECT_EQ("xyz", final_monitor_records["xyz"].extension_id); 5845 EXPECT_EQ("xyz", final_monitor_records["xyz"].extension_id);
5846 EXPECT_EQ(2049U, final_monitor_records["ABC"].bookmark_write_count); 5846 EXPECT_EQ(2049U, final_monitor_records["ABC"].bookmark_write_count);
5847 EXPECT_EQ(4U, final_monitor_records["xyz"].bookmark_write_count); 5847 EXPECT_EQ(4U, final_monitor_records["xyz"].bookmark_write_count);
5848 } else { 5848 } else {
5849 EXPECT_TRUE(final_monitor_records.empty()) 5849 EXPECT_TRUE(final_monitor_records.empty())
5850 << "Should not restore records after successful bookmark commit."; 5850 << "Should not restore records after successful bookmark commit.";
5851 } 5851 }
5852 } 5852 }
5853 5853
5854 } // namespace syncer 5854 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/engine_impl/syncer.cc ('k') | components/sync/engine_impl/worker_entity_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698