Index: components/sync_driver/ui_data_type_controller_unittest.cc |
diff --git a/components/sync_driver/ui_data_type_controller_unittest.cc b/components/sync_driver/ui_data_type_controller_unittest.cc |
index 0082c166265a174c71727b3f7210f7e4fc55dc2c..f6f2b94ce8708d977a6004837ff7f49a2f619ab7 100644 |
--- a/components/sync_driver/ui_data_type_controller_unittest.cc |
+++ b/components/sync_driver/ui_data_type_controller_unittest.cc |
@@ -83,6 +83,7 @@ class SyncUIDataTypeControllerTest : public testing::Test, |
preference_dtc_->StartAssociating( |
base::Bind(&StartCallbackMock::Run, |
base::Unretained(&start_callback_))); |
+ PumpLoop(); |
} |
void PumpLoop() { |
@@ -126,6 +127,19 @@ TEST_F(SyncUIDataTypeControllerTest, StartStop) { |
EXPECT_FALSE(syncable_service_.syncing()); |
} |
+// Start and then stop the DTC before the Start had a chance to perform |
+// association. Verify that the service never started and is NOT_RUNNING. |
+TEST_F(SyncUIDataTypeControllerTest, StartStopBeforeAssociation) { |
+ EXPECT_EQ(DataTypeController::NOT_RUNNING, preference_dtc_->state()); |
+ EXPECT_FALSE(syncable_service_.syncing()); |
+ message_loop_.PostTask(FROM_HERE, |
+ base::Bind(&UIDataTypeController::Stop, |
+ preference_dtc_)); |
+ Start(); |
+ EXPECT_EQ(DataTypeController::NOT_RUNNING, preference_dtc_->state()); |
+ EXPECT_FALSE(syncable_service_.syncing()); |
+} |
+ |
// Start the DTC when no user nodes are created. Verify that the callback |
// is called with OK_FIRST_RUN. Stop the DTC. |
TEST_F(SyncUIDataTypeControllerTest, StartStopFirstRun) { |