Index: trunk/src/components/sync_driver/data_type_manager_impl_unittest.cc |
=================================================================== |
--- trunk/src/components/sync_driver/data_type_manager_impl_unittest.cc (revision 289352) |
+++ trunk/src/components/sync_driver/data_type_manager_impl_unittest.cc (working copy) |
@@ -394,7 +394,7 @@ |
AddController(PASSWORDS); |
SetConfigureStartExpectation(); |
- SetConfigureDoneExpectation(DataTypeManager::PARTIAL_SUCCESS); |
+ SetConfigureDoneExpectation(DataTypeManager::OK); |
const ModelTypeSet types(PASSWORDS); |
dtm_->set_priority_types(AddHighPriorityTypesTo(types)); |
@@ -651,7 +651,7 @@ |
AddController(PREFERENCES); |
SetConfigureStartExpectation(); |
- SetConfigureDoneExpectation(DataTypeManager::PARTIAL_SUCCESS); |
+ SetConfigureDoneExpectation(DataTypeManager::OK); |
// Step 1. |
Configure(dtm_.get(), ModelTypeSet(BOOKMARKS, PREFERENCES)); |
@@ -1024,7 +1024,7 @@ |
// Initial configure. |
SetConfigureStartExpectation(); |
- SetConfigureDoneExpectation(DataTypeManager::PARTIAL_SUCCESS); |
+ SetConfigureDoneExpectation(DataTypeManager::OK); |
// Initially only PREFERENCES is configured. |
configurer_.set_expected_configure_types( |
@@ -1076,7 +1076,7 @@ |
// Initial configure. |
SetConfigureStartExpectation(); |
- SetConfigureDoneExpectation(DataTypeManager::PARTIAL_SUCCESS); |
+ SetConfigureDoneExpectation(DataTypeManager::OK); |
// Initially only PREFERENCES is configured. |
configurer_.set_expected_configure_types( |
@@ -1167,7 +1167,7 @@ |
AddController(BOOKMARKS); // Will be disabled due to datatype error. |
SetConfigureStartExpectation(); |
- SetConfigureDoneExpectation(DataTypeManager::PARTIAL_SUCCESS); |
+ SetConfigureDoneExpectation(DataTypeManager::OK); |
Configure(dtm_.get(), ModelTypeSet(BOOKMARKS, PREFERENCES)); |
FinishDownload(*dtm_, ModelTypeSet(), ModelTypeSet()); |
@@ -1196,4 +1196,38 @@ |
EXPECT_EQ(DataTypeController::RUNNING, GetController(BOOKMARKS)->state()); |
} |
+TEST_F(SyncDataTypeManagerImplTest, UnreadyType) { |
+ AddController(BOOKMARKS); |
+ GetController(BOOKMARKS)->SetReadyForStart(false); |
+ |
+ // Bookmarks is never started due to being unready. |
+ SetConfigureStartExpectation(); |
+ SetConfigureDoneExpectation(DataTypeManager::OK); |
+ Configure(dtm_.get(), ModelTypeSet(BOOKMARKS)); |
+ FinishDownload(*dtm_, ModelTypeSet(), ModelTypeSet()); |
+ EXPECT_EQ(DataTypeController::NOT_RUNNING, GetController(BOOKMARKS)->state()); |
+ EXPECT_EQ(DataTypeManager::CONFIGURED, dtm_->state()); |
+ EXPECT_EQ(0U, configurer_.activated_types().Size()); |
+ Mock::VerifyAndClearExpectations(&observer_); |
+ |
+ // Bookmarks should start normally now. |
+ GetController(BOOKMARKS)->SetReadyForStart(true); |
+ SetConfigureStartExpectation(); |
+ SetConfigureDoneExpectation(DataTypeManager::OK); |
+ Configure(dtm_.get(), ModelTypeSet(BOOKMARKS)); |
+ EXPECT_EQ(DataTypeManager::DOWNLOAD_PENDING, dtm_->state()); |
+ |
+ FinishDownload(*dtm_, ModelTypeSet(), ModelTypeSet()); |
+ FinishDownload(*dtm_, ModelTypeSet(BOOKMARKS), ModelTypeSet()); |
+ EXPECT_EQ(DataTypeManager::CONFIGURING, dtm_->state()); |
+ |
+ GetController(BOOKMARKS)->FinishStart(DataTypeController::OK); |
+ EXPECT_EQ(DataTypeManager::CONFIGURED, dtm_->state()); |
+ EXPECT_EQ(1U, configurer_.activated_types().Size()); |
+ |
+ dtm_->Stop(); |
+ EXPECT_EQ(DataTypeManager::STOPPED, dtm_->state()); |
+ EXPECT_TRUE(configurer_.activated_types().Empty()); |
+} |
+ |
} // namespace sync_driver |