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

Unified Diff: chrome/browser/sync/glue/data_type_manager_impl_unittest.cc

Issue 10387144: [Sync] - Implement isolated model association. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For submitting. Created 8 years, 7 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: 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.
« no previous file with comments | « chrome/browser/sync/glue/data_type_manager_impl.cc ('k') | chrome/browser/sync/glue/fake_data_type_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698