Chromium Code Reviews| 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 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 724 EXPECT_EQ(1, service()->CountActiveDevices()); | 724 EXPECT_EQ(1, service()->CountActiveDevices()); |
| 725 | 725 |
| 726 change_list.clear(); | 726 change_list.clear(); |
| 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 TEST_F(DeviceInfoServiceTest, MultipleOnProviderInitialized) { | |
| 735 set_local_device(base::WrapUnique(new LocalDeviceInfoProviderMock())); | |
|
maxbogue
2016/10/25 19:28:33
MakeUnique?
skym
2016/10/25 19:32:48
Done.
| |
| 736 InitializeAndPump(); | |
| 737 EXPECT_EQ(nullptr, processor()->metadata()); | |
| 738 | |
| 739 // Verify the processor was given metadata. | |
| 740 local_device()->Initialize(CreateDeviceInfo()); | |
| 741 base::RunLoop().RunUntilIdle(); | |
| 742 const MetadataBatch* metadata = processor()->metadata(); | |
| 743 EXPECT_NE(nullptr, metadata); | |
| 744 | |
| 745 // Pointer address of metadata should remain constant because the processor | |
| 746 // should not have been given new metadata. | |
| 747 local_device()->Initialize(CreateDeviceInfo()); | |
| 748 base::RunLoop().RunUntilIdle(); | |
| 749 EXPECT_EQ(metadata, processor()->metadata()); | |
| 750 } | |
| 751 | |
| 734 } // namespace | 752 } // namespace |
| 735 | 753 |
| 736 } // namespace syncer | 754 } // namespace syncer |
| OLD | NEW |