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

Unified Diff: components/sync/device_info/device_info_service_unittest.cc

Issue 2451793003: [Sync] Avoid sending the processor metadata again on re-enabling sync. (Closed)
Patch Set: Update for Max. Created 4 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/sync/device_info/device_info_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 83a9c8d4e55a32dd1f696f5fde7bf3a0277fe549..4b5d9b30eae570bf431b1116172392f1b8500e99 100644
--- a/components/sync/device_info/device_info_service_unittest.cc
+++ b/components/sync/device_info/device_info_service_unittest.cc
@@ -338,7 +338,7 @@ TEST_F(DeviceInfoServiceTest, LocalProviderSubscription) {
// Metadata shouldn't be loaded before the provider is initialized.
TEST_F(DeviceInfoServiceTest, LocalProviderInitRace) {
- set_local_device(base::WrapUnique(new LocalDeviceInfoProviderMock()));
+ set_local_device(base::MakeUnique<LocalDeviceInfoProviderMock>());
InitializeAndPump();
EXPECT_FALSE(processor()->metadata());
@@ -731,6 +731,24 @@ TEST_F(DeviceInfoServiceTest, CountActiveDevices) {
EXPECT_EQ(2, service()->CountActiveDevices());
}
+TEST_F(DeviceInfoServiceTest, MultipleOnProviderInitialized) {
+ set_local_device(base::MakeUnique<LocalDeviceInfoProviderMock>());
+ InitializeAndPump();
+ EXPECT_EQ(nullptr, processor()->metadata());
+
+ // Verify the processor was given metadata.
+ local_device()->Initialize(CreateDeviceInfo());
+ base::RunLoop().RunUntilIdle();
+ const MetadataBatch* metadata = processor()->metadata();
+ EXPECT_NE(nullptr, metadata);
+
+ // Pointer address of metadata should remain constant because the processor
+ // should not have been given new metadata.
+ local_device()->Initialize(CreateDeviceInfo());
+ base::RunLoop().RunUntilIdle();
+ EXPECT_EQ(metadata, processor()->metadata());
+}
+
} // namespace
} // namespace syncer
« no previous file with comments | « components/sync/device_info/device_info_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698