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 |