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

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

Issue 10694168: Revert 146422 - Merge 144583 - sync: fix reentrancy crash in ModelAssociationManager (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1180/src/
Patch Set: Created 8 years, 5 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
« no previous file with comments | « chrome/browser/sync/glue/model_association_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/glue/model_association_manager_unittest.cc
===================================================================
--- chrome/browser/sync/glue/model_association_manager_unittest.cc (revision 146436)
+++ chrome/browser/sync/glue/model_association_manager_unittest.cc (working copy)
@@ -211,76 +211,6 @@
DataTypeController::UNRECOVERABLE_ERROR);
}
-TEST_F(ModelAssociationManagerTest, InitializeAbortsLoad) {
- controllers_[syncable::BOOKMARKS] =
- new FakeDataTypeController(syncable::BOOKMARKS);
- controllers_[syncable::THEMES] =
- new FakeDataTypeController(syncable::THEMES);
-
- GetController(controllers_, syncable::BOOKMARKS)->SetDelayModelLoad();
- ModelAssociationManager model_association_manager(&controllers_,
- &result_processor_);
- syncable::ModelTypeSet types(syncable::BOOKMARKS, syncable::THEMES);
-
- syncable::ModelTypeSet expected_types_waiting_to_load;
- expected_types_waiting_to_load.Put(syncable::BOOKMARKS);
- DataTypeManager::ConfigureResult expected_result_partially_done(
- DataTypeManager::PARTIAL_SUCCESS,
- types,
- std::list<csync::SyncError>(),
- expected_types_waiting_to_load);
-
- model_association_manager.Initialize(types);
- model_association_manager.StopDisabledTypes();
-
- model_association_manager.StartAssociationAsync();
-
- EXPECT_CALL(result_processor_, OnModelAssociationDone(_)).
- WillOnce(VerifyResult(expected_result_partially_done));
-
- base::OneShotTimer<ModelAssociationManager>* timer =
- model_association_manager.GetTimerForTesting();
-
- base::Closure task = timer->user_task();
- timer->Stop();
- task.Run(); // Bookmark load times out here.
-
- // Apps finishes associating here.
- GetController(controllers_, syncable::THEMES)->FinishStart(
- DataTypeController::OK);
-
- // At this point, BOOKMARKS is still waiting to load (as evidenced by
- // expected_result_partially_done). If we schedule another Initialize (which
- // could happen in practice due to reconfiguration), this should abort
- // BOOKMARKS. Aborting will call ModelLoadCallback, but the
- // ModelAssociationManager should be smart enough to know that this is not due
- // to the type having completed loading.
- EXPECT_CALL(result_processor_, OnTypesLoaded()).Times(0);
-
- EXPECT_EQ(GetController(controllers_, syncable::BOOKMARKS)->state(),
- DataTypeController::MODEL_STARTING);
-
- model_association_manager.Initialize(types);
- EXPECT_EQ(GetController(controllers_, syncable::BOOKMARKS)->state(),
- DataTypeController::NOT_RUNNING);
-
- DataTypeManager::ConfigureResult expected_result_done(
- DataTypeManager::OK,
- types,
- std::list<csync::SyncError>(),
- syncable::ModelTypeSet());
- EXPECT_CALL(result_processor_, OnModelAssociationDone(_)).
- WillOnce(VerifyResult(expected_result_done));
-
- model_association_manager.StopDisabledTypes();
- model_association_manager.StartAssociationAsync();
-
- GetController(controllers_,
- syncable::BOOKMARKS)->SimulateModelLoadFinishing();
- GetController(controllers_, syncable::BOOKMARKS)->FinishStart(
- DataTypeController::OK);
-}
-
// Start 2 types. One of which timeout loading. Ensure that type is
// fully configured eventually.
TEST_F(ModelAssociationManagerTest, ModelStartWithSlowLoadingType) {
@@ -351,3 +281,4 @@
} // namespace browser_sync
+
« no previous file with comments | « chrome/browser/sync/glue/model_association_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698