diff options
author | bzanotti <bzanotti@chromium.org> | 2015-04-24 01:26:45 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-24 08:26:49 +0000 |
commit | 6eaa0a3fbc876b081de7504aaf9647f040671dbc (patch) | |
tree | 2323e6d78fd0c781fba0b0888aa3133eb1df3b40 /components | |
parent | b57efd65176595d82b49df5a4ec5e70c11b8a14e (diff) | |
download | chromium_src-6eaa0a3fbc876b081de7504aaf9647f040671dbc.zip chromium_src-6eaa0a3fbc876b081de7504aaf9647f040671dbc.tar.gz chromium_src-6eaa0a3fbc876b081de7504aaf9647f040671dbc.tar.bz2 |
Correctly stop models when stopping NonUIDataTypeController.
When NonUIDataTypeController was stopped while in the ASSOCIATING
state, the models were not stopped even though this state is only
accessible when the models are already loaded.
BUG=479737
Review URL: https://codereview.chromium.org/1096093004
Cr-Commit-Position: refs/heads/master@{#326758}
Diffstat (limited to 'components')
-rw-r--r-- | components/sync_driver/non_ui_data_type_controller.cc | 1 | ||||
-rw-r--r-- | components/sync_driver/non_ui_data_type_controller_unittest.cc | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/components/sync_driver/non_ui_data_type_controller.cc b/components/sync_driver/non_ui_data_type_controller.cc index df189b0..eb86a9a 100644 --- a/components/sync_driver/non_ui_data_type_controller.cc +++ b/components/sync_driver/non_ui_data_type_controller.cc @@ -122,6 +122,7 @@ void NonUIDataTypeController::Stop() { return; // The datatype was never activated, we're done. case ASSOCIATING: state_ = STOPPING; + StopModels(); // We continue on to deactivate the datatype and stop the local service. break; case MODEL_LOADED: diff --git a/components/sync_driver/non_ui_data_type_controller_unittest.cc b/components/sync_driver/non_ui_data_type_controller_unittest.cc index 3652407..27fe04e 100644 --- a/components/sync_driver/non_ui_data_type_controller_unittest.cc +++ b/components/sync_driver/non_ui_data_type_controller_unittest.cc @@ -393,6 +393,7 @@ TEST_F(SyncNonUIDataTypeControllerTest, AbortDuringAssociation) { syncer::SyncError::DATATYPE_ERROR, "Disconnected.", AUTOFILL_PROFILE))); + EXPECT_CALL(*dtc_mock_.get(), StopModels()); EXPECT_CALL(*change_processor_.get(), Disconnect()) .WillOnce(DoAll(SignalEvent(&pause_db_thread), Return(true))); EXPECT_EQ(DataTypeController::NOT_RUNNING, non_ui_dtc_->state()); @@ -411,7 +412,7 @@ TEST_F(SyncNonUIDataTypeControllerTest, StartAfterSyncShutdown) { SetStartExpectations(); // We don't expect StopSyncing to be called because local_service_ will never // have been set. - EXPECT_CALL(*change_processor_.get(), Disconnect()).WillOnce(Return(true)); + SetStopExpectations(); EXPECT_EQ(DataTypeController::NOT_RUNNING, non_ui_dtc_->state()); Start(); non_ui_dtc_->Stop(); |