| Index: chrome/browser/sync/glue/data_type_manager_impl_unittest.cc
|
| diff --git a/chrome/browser/sync/glue/data_type_manager_impl_unittest.cc b/chrome/browser/sync/glue/data_type_manager_impl_unittest.cc
|
| index 69fa56141f68465c16c108379fef929b691673f3..101d74776bcefda99294b5c3e6b7ea0e48abd03e 100644
|
| --- a/chrome/browser/sync/glue/data_type_manager_impl_unittest.cc
|
| +++ b/chrome/browser/sync/glue/data_type_manager_impl_unittest.cc
|
| @@ -26,6 +26,7 @@ using syncable::ModelType;
|
| using syncable::ModelTypeSet;
|
| using syncable::ModelTypeToString;
|
| using syncable::BOOKMARKS;
|
| +using syncable::APPS;
|
| using syncable::PASSWORDS;
|
| using syncable::PREFERENCES;
|
| using testing::_;
|
| @@ -202,6 +203,52 @@ TEST_P(SyncDataTypeManagerImplTest, ConfigureOne) {
|
| EXPECT_EQ(DataTypeManager::STOPPED, dtm.state());
|
| }
|
|
|
| +// Set up a DTM with 2 controllers. configure it. One of them finishes loading
|
| +// after the timeout. Make sure eventually all are configured.
|
| +TEST_P(SyncDataTypeManagerImplTest, ConfigureSlowLoadingType) {
|
| + AddController(BOOKMARKS);
|
| + AddController(APPS);
|
| +
|
| + GetController(BOOKMARKS)->SetDelayModelLoad();
|
| +
|
| + DataTypeManagerImpl dtm(&configurer_, &controllers_);
|
| + SetConfigureStartExpectation();
|
| + SetConfigureDoneExpectation(DataTypeManager::PARTIAL_SUCCESS);
|
| +
|
| + syncable::ModelTypeSet types;
|
| + types.Put(BOOKMARKS);
|
| + types.Put(APPS);
|
| +
|
| + Configure(&dtm, types);
|
| + EXPECT_EQ(DataTypeManager::DOWNLOAD_PENDING, dtm.state());
|
| +
|
| + FinishDownload(dtm, ModelTypeSet());
|
| + EXPECT_EQ(DataTypeManager::CONFIGURING, dtm.state());
|
| +
|
| + base::OneShotTimer<ModelAssociationManager>* timer =
|
| + dtm.GetModelAssociationManagerForTesting()->GetTimerForTesting();
|
| +
|
| + base::Closure task = timer->user_task();
|
| + timer->Stop();
|
| + task.Run();
|
| +
|
| + SetConfigureDoneExpectation(DataTypeManager::OK);
|
| + GetController(APPS)->FinishStart(DataTypeController::OK);
|
| +
|
| + SetConfigureStartExpectation();
|
| + GetController(BOOKMARKS)->SimulateModelLoadFinishing();
|
| +
|
| + FinishDownload(dtm, ModelTypeSet());
|
| + GetController(BOOKMARKS)->SimulateModelLoadFinishing();
|
| +
|
| + GetController(BOOKMARKS)->FinishStart(DataTypeController::OK);
|
| + EXPECT_EQ(DataTypeManager::CONFIGURED, dtm.state());
|
| +
|
| + dtm.Stop();
|
| + EXPECT_EQ(DataTypeManager::STOPPED, dtm.state());
|
| +}
|
| +
|
| +
|
| // Set up a DTM with a single controller, configure it, but stop it
|
| // before finishing the download. It should still be safe to run the
|
| // download callback even after the DTM is stopped and destroyed.
|
|
|