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

Side by Side Diff: components/sync/device_info/device_info_service_unittest.cc

Issue 2458013002: [Sync] Rename ModelTypeService to ModelTypeSyncBridge. (Closed)
Patch Set: s/SetBridgeError/ErrorOnNextCall Created 4 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/sync/device_info/device_info_service.h" 5 #include "components/sync/device_info/device_info_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 15 matching lines...) Expand all
26 26
27 namespace syncer { 27 namespace syncer {
28 28
29 using base::Time; 29 using base::Time;
30 using base::TimeDelta; 30 using base::TimeDelta;
31 using sync_pb::DeviceInfoSpecifics; 31 using sync_pb::DeviceInfoSpecifics;
32 using sync_pb::EntitySpecifics; 32 using sync_pb::EntitySpecifics;
33 using sync_pb::ModelTypeState; 33 using sync_pb::ModelTypeState;
34 34
35 using DeviceInfoList = std::vector<std::unique_ptr<DeviceInfo>>; 35 using DeviceInfoList = std::vector<std::unique_ptr<DeviceInfo>>;
36 using StorageKeyList = ModelTypeService::StorageKeyList; 36 using StorageKeyList = ModelTypeSyncBridge::StorageKeyList;
37 using RecordList = ModelTypeStore::RecordList; 37 using RecordList = ModelTypeStore::RecordList;
38 using Result = ModelTypeStore::Result; 38 using Result = ModelTypeStore::Result;
39 using StartCallback = ModelTypeChangeProcessor::StartCallback; 39 using StartCallback = ModelTypeChangeProcessor::StartCallback;
40 using WriteBatch = ModelTypeStore::WriteBatch; 40 using WriteBatch = ModelTypeStore::WriteBatch;
41 41
42 namespace { 42 namespace {
43 43
44 std::unique_ptr<DeviceInfo> CreateDeviceInfo() { 44 std::unique_ptr<DeviceInfo> CreateDeviceInfo() {
45 return base::MakeUnique<DeviceInfo>( 45 return base::MakeUnique<DeviceInfo>(
46 "guid_1", "client_1", "Chromium 10k", "Chrome 10k", 46 "guid_1", "client_1", "Chromium 10k", "Chrome 10k",
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 service_->RemoveObserver(this); 172 service_->RemoveObserver(this);
173 173
174 // Force all remaining (store) tasks to execute so we don't leak memory. 174 // Force all remaining (store) tasks to execute so we don't leak memory.
175 base::RunLoop().RunUntilIdle(); 175 base::RunLoop().RunUntilIdle();
176 } 176 }
177 177
178 void OnDeviceInfoChange() override { change_count_++; } 178 void OnDeviceInfoChange() override { change_count_++; }
179 179
180 std::unique_ptr<ModelTypeChangeProcessor> CreateModelTypeChangeProcessor( 180 std::unique_ptr<ModelTypeChangeProcessor> CreateModelTypeChangeProcessor(
181 ModelType type, 181 ModelType type,
182 ModelTypeService* service) { 182 ModelTypeSyncBridge* bridge) {
183 auto processor = base::MakeUnique<RecordingModelTypeChangeProcessor>(); 183 auto processor = base::MakeUnique<RecordingModelTypeChangeProcessor>();
184 processor_ = processor.get(); 184 processor_ = processor.get();
185 return std::move(processor); 185 return std::move(processor);
186 } 186 }
187 187
188 // Initialized the service based on the current local device and store. Can 188 // Initialized the service based on the current local device and store. Can
189 // only be called once per run, as it passes |store_|. 189 // only be called once per run, as it passes |store_|.
190 void InitializeService() { 190 void InitializeService() {
191 ASSERT_TRUE(store_); 191 ASSERT_TRUE(store_);
192 service_ = base::MakeUnique<DeviceInfoService>( 192 service_ = base::MakeUnique<DeviceInfoService>(
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 768
769 // Reloading from storage shouldn't contain remote data. 769 // Reloading from storage shouldn't contain remote data.
770 RestartService(); 770 RestartService();
771 EXPECT_EQ(1u, service()->GetAllDeviceInfo().size()); 771 EXPECT_EQ(1u, service()->GetAllDeviceInfo().size());
772 EXPECT_EQ(4, change_count()); 772 EXPECT_EQ(4, change_count());
773 } 773 }
774 774
775 } // namespace 775 } // namespace
776 776
777 } // namespace syncer 777 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/device_info/device_info_service.cc ('k') | components/sync/driver/fake_sync_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698