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

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

Issue 9749012: [Sync] Have SyncableService's take ownership of their SyncChangeProcessor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initial comments Created 8 years, 9 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/search_engine_data_type_controller_unittest.cc
diff --git a/chrome/browser/sync/glue/search_engine_data_type_controller_unittest.cc b/chrome/browser/sync/glue/search_engine_data_type_controller_unittest.cc
index 311f8691a7e3ba01452749bc96103f3deb33cba3..897bfe6e804cb006eff366decb16a41138eeb26e 100644
--- a/chrome/browser/sync/glue/search_engine_data_type_controller_unittest.cc
+++ b/chrome/browser/sync/glue/search_engine_data_type_controller_unittest.cc
@@ -29,6 +29,10 @@ using testing::SetArgumentPointee;
namespace browser_sync {
namespace {
+ACTION(MakeSharedChangeProcessor) {
+ return new SharedChangeProcessor();
+}
+
ACTION_P(ReturnAndRelease, change_processor) {
return change_processor->release();
}
@@ -51,6 +55,9 @@ class SyncSearchEngineDataTypeControllerTest : public testing::Test {
}
virtual void TearDown() {
+ // Must be done before we pump the loop.
+ syncable_service_.StopSyncing(syncable::SEARCH_ENGINES);
+ search_engine_dtc_ = NULL;
test_util_.TearDown();
}
@@ -65,6 +72,8 @@ class SyncSearchEngineDataTypeControllerTest : public testing::Test {
EXPECT_CALL(*profile_sync_factory_,
GetSyncableServiceForType(syncable::SEARCH_ENGINES)).
WillOnce(Return(syncable_service_.AsWeakPtr()));
+ EXPECT_CALL(*profile_sync_factory_, CreateSharedChangeProcessor()).
+ WillOnce(MakeSharedChangeProcessor());
EXPECT_CALL(*profile_sync_factory_, CreateGenericChangeProcessor(_, _, _)).
WillOnce(ReturnAndRelease(&change_processor_));
}
@@ -194,6 +203,9 @@ TEST_F(SyncSearchEngineDataTypeControllerTest, OnUnrecoverableError) {
base::Bind(&StartCallbackMock::Run, base::Unretained(&start_callback_)));
// This should cause search_engine_dtc_->Stop() to be called.
search_engine_dtc_->OnUnrecoverableError(FROM_HERE, "Test");
+ test_util_.PumpLoop();
+ EXPECT_EQ(DataTypeController::NOT_RUNNING, search_engine_dtc_->state());
+ EXPECT_FALSE(syncable_service_.syncing());
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698