OLD | NEW |
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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 ModelTypeService* service) { | 181 ModelTypeService* service) { |
182 auto processor = base::MakeUnique<RecordingModelTypeChangeProcessor>(); | 182 auto processor = base::MakeUnique<RecordingModelTypeChangeProcessor>(); |
183 processor_ = processor.get(); | 183 processor_ = processor.get(); |
184 return std::move(processor); | 184 return std::move(processor); |
185 } | 185 } |
186 | 186 |
187 // Initialized the service based on the current local device and store. Can | 187 // Initialized the service based on the current local device and store. Can |
188 // only be called once per run, as it passes |store_|. | 188 // only be called once per run, as it passes |store_|. |
189 void InitializeService() { | 189 void InitializeService() { |
190 ASSERT_TRUE(store_); | 190 ASSERT_TRUE(store_); |
191 service_.reset(new DeviceInfoService( | 191 service_ = base::MakeUnique<DeviceInfoService>( |
192 local_device_.get(), | 192 local_device_.get(), |
193 base::Bind(&ModelTypeStoreTestUtil::MoveStoreToCallback, | 193 base::Bind(&ModelTypeStoreTestUtil::MoveStoreToCallback, |
194 base::Passed(&store_)), | 194 base::Passed(&store_)), |
195 base::Bind(&DeviceInfoServiceTest::CreateModelTypeChangeProcessor, | 195 base::Bind(&DeviceInfoServiceTest::CreateModelTypeChangeProcessor, |
196 base::Unretained(this)))); | 196 base::Unretained(this))); |
197 service_->AddObserver(this); | 197 service_->AddObserver(this); |
198 } | 198 } |
199 | 199 |
200 // Creates the service and runs any outstanding tasks. This will typically | 200 // Creates the service and runs any outstanding tasks. This will typically |
201 // cause all initialization callbacks between the sevice and store to fire. | 201 // cause all initialization callbacks between the sevice and store to fire. |
202 void InitializeAndPump() { | 202 void InitializeAndPump() { |
203 InitializeService(); | 203 InitializeService(); |
204 base::RunLoop().RunUntilIdle(); | 204 base::RunLoop().RunUntilIdle(); |
205 } | 205 } |
206 | 206 |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 specifics.set_cache_guid("non-local"); | 727 specifics.set_cache_guid("non-local"); |
728 PushBackEntityChangeAdd(specifics, &change_list); | 728 PushBackEntityChangeAdd(specifics, &change_list); |
729 service()->ApplySyncChanges(service()->CreateMetadataChangeList(), | 729 service()->ApplySyncChanges(service()->CreateMetadataChangeList(), |
730 change_list); | 730 change_list); |
731 EXPECT_EQ(2, service()->CountActiveDevices()); | 731 EXPECT_EQ(2, service()->CountActiveDevices()); |
732 } | 732 } |
733 | 733 |
734 } // namespace | 734 } // namespace |
735 | 735 |
736 } // namespace syncer | 736 } // namespace syncer |
OLD | NEW |