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 "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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(syncer::ModelType type, |
113 const CommitCounters& counters) override; | 113 const CommitCounters& counters) override; |
114 void OnUpdateCountersUpdated(syncer::ModelType type, | 114 void OnUpdateCountersUpdated(syncer::ModelType type, |
115 const UpdateCounters& counters) override; | 115 const UpdateCounters& counters) override; |
116 void OnStatusCountersUpdated(syncer::ModelType type, | 116 void OnStatusCountersUpdated( |
117 const StatusCounters& counters) override; | 117 syncer::ModelType type, |
| 118 std::unique_ptr<StatusCounters> counters) override; |
118 | 119 |
119 private: | 120 private: |
120 std::map<ModelType, CommitCounters> commit_counters_map_; | 121 std::map<ModelType, CommitCounters> commit_counters_map_; |
121 std::map<ModelType, UpdateCounters> update_counters_map_; | 122 std::map<ModelType, UpdateCounters> update_counters_map_; |
122 std::map<ModelType, StatusCounters> status_counters_map_; | 123 std::map<ModelType, StatusCounters> status_counters_map_; |
123 }; | 124 }; |
124 | 125 |
125 TypeDebugInfoCache::TypeDebugInfoCache() {} | 126 TypeDebugInfoCache::TypeDebugInfoCache() {} |
126 | 127 |
127 TypeDebugInfoCache::~TypeDebugInfoCache() {} | 128 TypeDebugInfoCache::~TypeDebugInfoCache() {} |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 } | 167 } |
167 | 168 |
168 void TypeDebugInfoCache::OnUpdateCountersUpdated( | 169 void TypeDebugInfoCache::OnUpdateCountersUpdated( |
169 syncer::ModelType type, | 170 syncer::ModelType type, |
170 const UpdateCounters& counters) { | 171 const UpdateCounters& counters) { |
171 update_counters_map_[type] = counters; | 172 update_counters_map_[type] = counters; |
172 } | 173 } |
173 | 174 |
174 void TypeDebugInfoCache::OnStatusCountersUpdated( | 175 void TypeDebugInfoCache::OnStatusCountersUpdated( |
175 syncer::ModelType type, | 176 syncer::ModelType type, |
176 const StatusCounters& counters) { | 177 std::unique_ptr<StatusCounters> counters) { |
177 status_counters_map_[type] = counters; | 178 status_counters_map_[type] = *counters; |
178 } | 179 } |
179 | 180 |
180 } // namespace | 181 } // namespace |
181 | 182 |
182 class SyncerTest : public testing::Test, | 183 class SyncerTest : public testing::Test, |
183 public SyncCycle::Delegate, | 184 public SyncCycle::Delegate, |
184 public SyncEngineEventListener { | 185 public SyncEngineEventListener { |
185 protected: | 186 protected: |
186 SyncerTest() | 187 SyncerTest() |
187 : extensions_activity_(new ExtensionsActivity), | 188 : extensions_activity_(new ExtensionsActivity), |
(...skipping 5657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5845 EXPECT_EQ("xyz", final_monitor_records["xyz"].extension_id); | 5846 EXPECT_EQ("xyz", final_monitor_records["xyz"].extension_id); |
5846 EXPECT_EQ(2049U, final_monitor_records["ABC"].bookmark_write_count); | 5847 EXPECT_EQ(2049U, final_monitor_records["ABC"].bookmark_write_count); |
5847 EXPECT_EQ(4U, final_monitor_records["xyz"].bookmark_write_count); | 5848 EXPECT_EQ(4U, final_monitor_records["xyz"].bookmark_write_count); |
5848 } else { | 5849 } else { |
5849 EXPECT_TRUE(final_monitor_records.empty()) | 5850 EXPECT_TRUE(final_monitor_records.empty()) |
5850 << "Should not restore records after successful bookmark commit."; | 5851 << "Should not restore records after successful bookmark commit."; |
5851 } | 5852 } |
5852 } | 5853 } |
5853 | 5854 |
5854 } // namespace syncer | 5855 } // namespace syncer |
OLD | NEW |