Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Unified Diff: components/sync_driver/data_type_manager_impl_unittest.cc

Issue 420633002: [Sync] Cleanup datatype configuration error handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/sync_driver/data_type_manager_impl_unittest.cc
diff --git a/components/sync_driver/data_type_manager_impl_unittest.cc b/components/sync_driver/data_type_manager_impl_unittest.cc
index 2f35d0363d9fb0ffad93202e4fd8203bdcd91102..de5855bafa69fa0b14d26df7d1cd29fe9b07325e 100644
--- a/components/sync_driver/data_type_manager_impl_unittest.cc
+++ b/components/sync_driver/data_type_manager_impl_unittest.cc
@@ -394,7 +394,7 @@ TEST_F(SyncDataTypeManagerImplTest, OneWaitingForCrypto) {
AddController(PASSWORDS);
SetConfigureStartExpectation();
- SetConfigureDoneExpectation(DataTypeManager::PARTIAL_SUCCESS);
+ SetConfigureDoneExpectation(DataTypeManager::OK);
const ModelTypeSet types(PASSWORDS);
dtm_->set_priority_types(AddHighPriorityTypesTo(types));
@@ -651,7 +651,7 @@ TEST_F(SyncDataTypeManagerImplTest, OneControllerFailsAssociation) {
AddController(PREFERENCES);
SetConfigureStartExpectation();
- SetConfigureDoneExpectation(DataTypeManager::PARTIAL_SUCCESS);
+ SetConfigureDoneExpectation(DataTypeManager::OK);
// Step 1.
Configure(dtm_.get(), ModelTypeSet(BOOKMARKS, PREFERENCES));
@@ -1024,7 +1024,7 @@ TEST_F(SyncDataTypeManagerImplTest, HighPriorityAssociationFailure) {
// Initial configure.
SetConfigureStartExpectation();
- SetConfigureDoneExpectation(DataTypeManager::PARTIAL_SUCCESS);
+ SetConfigureDoneExpectation(DataTypeManager::OK);
// Initially only PREFERENCES is configured.
configurer_.set_expected_configure_types(
@@ -1076,7 +1076,7 @@ TEST_F(SyncDataTypeManagerImplTest, LowPriorityAssociationFailure) {
// Initial configure.
SetConfigureStartExpectation();
- SetConfigureDoneExpectation(DataTypeManager::PARTIAL_SUCCESS);
+ SetConfigureDoneExpectation(DataTypeManager::OK);
// Initially only PREFERENCES is configured.
configurer_.set_expected_configure_types(
@@ -1167,7 +1167,7 @@ TEST_F(SyncDataTypeManagerImplTest, ReenableAfterDataTypeError) {
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 @@ TEST_F(SyncDataTypeManagerImplTest, ReenableAfterDataTypeError) {
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
« no previous file with comments | « components/sync_driver/data_type_manager_impl.cc ('k') | components/sync_driver/failed_data_types_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698