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

Unified Diff: components/sync/driver/data_type_manager_impl_unittest.cc

Issue 2485773003: [Sync] Ensure unready types' state is updated before every reconfiguration (Closed)
Patch Set: Address comment from Nicolas. Created 4 years, 1 month 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
« no previous file with comments | « components/sync/driver/data_type_manager_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3b2f9ba0a149ffda8b847610ba4bb7471bf2b25b..8c2ca081f6f63a18ef649cb8ac66070bdafbd7d9 100644
--- a/components/sync/driver/data_type_manager_impl_unittest.cc
+++ b/components/sync/driver/data_type_manager_impl_unittest.cc
@@ -1334,6 +1334,34 @@ TEST_F(SyncDataTypeManagerImplTest, UnreadyType) {
EXPECT_TRUE(configurer_.activated_types().Empty());
}
+// Tests that unready types are not started after ResetDataTypeErrors and
+// reconfiguration.
+TEST_F(SyncDataTypeManagerImplTest, UnreadyTypeResetReconfigure) {
+ AddController(BOOKMARKS);
+ GetController(BOOKMARKS)->SetReadyForStart(false);
+
+ // Bookmarks is never started due to being unready.
+ SetConfigureStartExpectation();
+ SetConfigureDoneExpectation(
+ DataTypeManager::OK,
+ BuildStatusTable(ModelTypeSet(), ModelTypeSet(), ModelTypeSet(BOOKMARKS),
+ ModelTypeSet()));
+ Configure(dtm_.get(), ModelTypeSet(BOOKMARKS));
+ // Second Configure sets a flag to perform reconfiguration after the first one
+ // is done.
+ Configure(dtm_.get(), ModelTypeSet(BOOKMARKS));
+
+ // Reset errors before triggering reconfiguration.
+ dtm_->ResetDataTypeErrors();
+
+ // Reconfiguration should update unready errors. Bookmarks shouldn't start.
+ FinishDownload(*dtm_, ModelTypeSet(), ModelTypeSet());
+ 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());
+}
+
TEST_F(SyncDataTypeManagerImplTest, ModelLoadError) {
AddController(BOOKMARKS);
GetController(BOOKMARKS)->SetModelLoadError(
« no previous file with comments | « components/sync/driver/data_type_manager_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698