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

Unified Diff: components/sync_driver/device_info_data_type_controller_unittest.cc

Issue 672863002: Sync: fix crash in DeviceInfoDataTypeController::Subscription destructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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_driver/device_info_data_type_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync_driver/device_info_data_type_controller_unittest.cc
diff --git a/components/sync_driver/device_info_data_type_controller_unittest.cc b/components/sync_driver/device_info_data_type_controller_unittest.cc
index 137ed253a10eb754173c8c76d69e912f0bdcf4fd..c6535cbb5ef28ca2f160c3a69f07ad9312e613ea 100644
--- a/components/sync_driver/device_info_data_type_controller_unittest.cc
+++ b/components/sync_driver/device_info_data_type_controller_unittest.cc
@@ -127,6 +127,19 @@ TEST_F(DeviceInfoDataTypeControllerTest, StartModelsDelayedByLocalDevice) {
EXPECT_TRUE(LoadResult());
}
+// Tests that DeviceInfoDataTypeControllerTest handles the situation
+// when everything stops before the start gets a chance to finish.
+TEST_F(DeviceInfoDataTypeControllerTest, DestructionWithDelayedStart) {
+ local_device_->SetInitialized(false);
+ Start();
+
+ controller_->Stop();
+ // Destroy |local_device_| and |controller_| out of order
+ // to verify that the controller doesn't crash in the destructor.
+ local_device_.reset();
+ controller_ = NULL;
+}
+
} // namespace
} // namespace sync_driver
« no previous file with comments | « components/sync_driver/device_info_data_type_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698