Chromium Code Reviews| Index: components/sync/device_info/device_info_service_unittest.cc |
| diff --git a/components/sync/device_info/device_info_service_unittest.cc b/components/sync/device_info/device_info_service_unittest.cc |
| index 6b4d4a684222a3a3a12fab90eb910136b0df12ee..010e9dee49fa81a39e5e59a2847d5dfee0766967 100644 |
| --- a/components/sync/device_info/device_info_service_unittest.cc |
| +++ b/components/sync/device_info/device_info_service_unittest.cc |
| @@ -760,22 +760,47 @@ TEST_F(DeviceInfoServiceTest, MultipleOnProviderInitialized) { |
| TEST_F(DeviceInfoServiceTest, SendLocalData) { |
| InitializeAndPump(); |
| - EXPECT_EQ(1, service()->CountActiveDevices()); |
| EXPECT_EQ(1, change_count()); |
| EXPECT_EQ(1u, processor()->put_multimap().size()); |
| ForcePulse(); |
| - EXPECT_EQ(1, service()->CountActiveDevices()); |
| EXPECT_EQ(2, change_count()); |
| EXPECT_EQ(2u, processor()->put_multimap().size()); |
| + // After clearing, pulsing should no-op and not result in a processor put or |
| + // a notification to observers. |
| local_device()->Clear(); |
| ForcePulse(); |
| - EXPECT_EQ(1, service()->CountActiveDevices()); |
| EXPECT_EQ(2, change_count()); |
| EXPECT_EQ(2u, processor()->put_multimap().size()); |
| } |
| +TEST_F(DeviceInfoServiceTest, DisableSync) { |
| + InitializeAndPump(); |
| + EXPECT_EQ(1u, service()->GetAllDeviceInfo().size()); |
| + EXPECT_EQ(1, change_count()); |
| + |
| + DeviceInfoSpecifics specifics = GenerateTestSpecifics(); |
| + EntityChangeList add_changes; |
| + PushBackEntityChangeAdd(specifics, &add_changes); |
| + EXPECT_FALSE( |
| + service() |
|
maxbogue
2016/10/26 18:18:30
nit: pull the error out onto a separate line to ma
skym
2016/10/26 18:24:35
Done.
|
| + ->ApplySyncChanges(service()->CreateMetadataChangeList(), add_changes) |
| + .IsSet()); |
| + EXPECT_EQ(2u, service()->GetAllDeviceInfo().size()); |
| + EXPECT_EQ(2, change_count()); |
| + |
| + // Should clear out all local data and notify observers. |
| + service()->DisableSync(); |
| + EXPECT_EQ(0u, service()->GetAllDeviceInfo().size()); |
| + EXPECT_EQ(3, change_count()); |
| + |
| + // Reloading from storage shouldn't contain remote data. |
| + RestartService(); |
| + EXPECT_EQ(1u, service()->GetAllDeviceInfo().size()); |
| + EXPECT_EQ(4, change_count()); |
| +} |
| + |
| } // namespace |
| } // namespace syncer |