+TEST_F(SyncDataTypeManagerImplTest, ModelLoadError) {
+ AddController(BOOKMARKS);
+ GetController(BOOKMARKS)->SetModelLoadError(syncer::SyncError(
+ FROM_HERE, SyncError::DATATYPE_ERROR, "load error", BOOKMARKS));
+
+ // Bookmarks is never started due to hitting a model load error.
+ SetConfigureStartExpectation();
+ SetConfigureDoneExpectation(DataTypeManager::OK,
+ BuildStatusTable(ModelTypeSet(),
+ ModelTypeSet(BOOKMARKS),
+ ModelTypeSet(),
+ ModelTypeSet()));
+ Configure(dtm_.get(), ModelTypeSet(BOOKMARKS));
+ FinishDownload(*dtm_, ModelTypeSet(), ModelTypeSet());
+ FinishDownload(*dtm_, ModelTypeSet(BOOKMARKS), ModelTypeSet());
+ EXPECT_EQ(DataTypeManager::CONFIGURED, dtm_->state());
+ EXPECT_EQ(DataTypeController::NOT_RUNNING, GetController(BOOKMARKS)->state());
+
+ EXPECT_EQ(0U, configurer_.activated_types().Size());
+}
+
+
+TEST_F(SyncDataTypeManagerImplTest, ErrorBeforeAssociation) {
+ AddController(BOOKMARKS);
+
+ // Bookmarks is never started due to hitting a datatype error while the DTM
+ // is still downloading types.
+ SetConfigureStartExpectation();
+ SetConfigureDoneExpectation(DataTypeManager::OK,
+ BuildStatusTable(ModelTypeSet(),
+ ModelTypeSet(BOOKMARKS),
+ ModelTypeSet(),
+ ModelTypeSet()));
+ Configure(dtm_.get(), ModelTypeSet(BOOKMARKS));
+ FinishDownload(*dtm_, ModelTypeSet(), ModelTypeSet());
+ GetController(BOOKMARKS)->OnSingleDataTypeUnrecoverableError(
+ syncer::SyncError(FROM_HERE,
+ SyncError::DATATYPE_ERROR,
+ "bookmarks error",
+ BOOKMARKS));
+ FinishDownload(*dtm_, ModelTypeSet(BOOKMARKS), ModelTypeSet());
+ FinishDownload(*dtm_, ModelTypeSet(), ModelTypeSet()); // Reconfig for error.
+ EXPECT_EQ(DataTypeManager::CONFIGURED, dtm_->state());
+ EXPECT_EQ(DataTypeController::NOT_RUNNING, GetController(BOOKMARKS)->state());
+
+ EXPECT_EQ(0U, configurer_.activated_types().Size());
+}
+