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

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

Issue 9264062: [Sync] Consolidate DataTypeController methods that post on the backend thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add suppressions Created 8 years, 11 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/new_non_frontend_data_type_controller_unittest.cc
diff --git a/chrome/browser/sync/glue/new_non_frontend_data_type_controller_unittest.cc b/chrome/browser/sync/glue/new_non_frontend_data_type_controller_unittest.cc
index 7039fd58d5995968b95a50c860721ab22938ae89..4517981424c81fe41a4081cbcea99b9e9b570dfc 100644
--- a/chrome/browser/sync/glue/new_non_frontend_data_type_controller_unittest.cc
+++ b/chrome/browser/sync/glue/new_non_frontend_data_type_controller_unittest.cc
@@ -88,11 +88,11 @@ class NewNonFrontendDataTypeControllerFake
GetWeakPtrToSyncableService() const OVERRIDE {
return profile_sync_factory()->GetAutofillProfileSyncableService(NULL);
}
- virtual bool StartAssociationAsync() OVERRIDE {
- mock_->StartAssociationAsync();
- return BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
- base::Bind(&NewNonFrontendDataTypeControllerFake::StartAssociation,
- this));
+
+ virtual bool PostTaskOnBackendThread(
+ const tracked_objects::Location& from_here,
+ const base::Closure& task) OVERRIDE {
+ return BrowserThread::PostTask(BrowserThread::DB, from_here, task);
}
// We mock the following methods because their default implementations do
@@ -103,12 +103,6 @@ class NewNonFrontendDataTypeControllerFake
virtual void StopModels() OVERRIDE {
mock_->StopModels();
}
- virtual void StopLocalServiceAsync() OVERRIDE {
- mock_->StopLocalServiceAsync();
- BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
- base::Bind(&NewNonFrontendDataTypeControllerFake::StopLocalService,
- this));
- }
virtual void RecordUnrecoverableError(
const tracked_objects::Location& from_here,
const std::string& message) OVERRIDE {
@@ -178,7 +172,6 @@ class NewNonFrontendDataTypeControllerTest : public testing::Test {
}
void SetAssociateExpectations() {
- EXPECT_CALL(*dtc_mock_, StartAssociationAsync());
EXPECT_CALL(*change_processor_, Connect(_,_,_,_)).WillOnce(Return(true));
EXPECT_CALL(*change_processor_, CryptoReadyIfNecessary(_)).
WillOnce(Return(true));
@@ -201,12 +194,10 @@ class NewNonFrontendDataTypeControllerTest : public testing::Test {
EXPECT_CALL(*dtc_mock_, StopModels());
EXPECT_CALL(*change_processor_, Disconnect()).WillOnce(Return(true));
EXPECT_CALL(service_, DeactivateDataType(_));
- EXPECT_CALL(*dtc_mock_, StopLocalServiceAsync());
EXPECT_CALL(syncable_service_, StopSyncing(_));
}
void SetStartFailExpectations(DataTypeController::StartResult result) {
- EXPECT_CALL(*dtc_mock_, StopLocalServiceAsync());
EXPECT_CALL(syncable_service_, StopSyncing(_));
EXPECT_CALL(*dtc_mock_, StopModels());
EXPECT_CALL(*dtc_mock_, RecordStartFailure(result));
@@ -245,7 +236,6 @@ TEST_F(NewNonFrontendDataTypeControllerTest, StartOk) {
TEST_F(NewNonFrontendDataTypeControllerTest, StartFirstRun) {
SetStartExpectations();
- EXPECT_CALL(*dtc_mock_, StartAssociationAsync());
EXPECT_CALL(*change_processor_, Connect(_,_,_,_)).WillOnce(Return(true));
EXPECT_CALL(*change_processor_, CryptoReadyIfNecessary(_)).
WillOnce(Return(true));
@@ -281,7 +271,6 @@ TEST_F(NewNonFrontendDataTypeControllerTest, AbortDuringStartModels) {
TEST_F(NewNonFrontendDataTypeControllerTest, StartAssociationFailed) {
SetStartExpectations();
- EXPECT_CALL(*dtc_mock_, StartAssociationAsync());
EXPECT_CALL(*change_processor_, Connect(_,_,_,_)).WillOnce(Return(true));
EXPECT_CALL(*change_processor_, CryptoReadyIfNecessary(_)).
WillOnce(Return(true));
@@ -307,7 +296,6 @@ TEST_F(NewNonFrontendDataTypeControllerTest,
SetStartExpectations();
SetStartFailExpectations(DataTypeController::UNRECOVERABLE_ERROR);
// Set up association to fail with an unrecoverable error.
- EXPECT_CALL(*dtc_mock_, StartAssociationAsync());
EXPECT_CALL(*change_processor_, Connect(_,_,_,_)).WillOnce(Return(true));
EXPECT_CALL(*change_processor_, CryptoReadyIfNecessary(_)).
WillRepeatedly(Return(true));
@@ -324,7 +312,6 @@ TEST_F(NewNonFrontendDataTypeControllerTest, StartAssociationCryptoNotReady) {
SetStartExpectations();
SetStartFailExpectations(DataTypeController::NEEDS_CRYPTO);
// Set up association to fail with a NEEDS_CRYPTO error.
- EXPECT_CALL(*dtc_mock_, StartAssociationAsync());
EXPECT_CALL(*change_processor_, Connect(_,_,_,_)).WillOnce(Return(true));
EXPECT_CALL(*change_processor_, CryptoReadyIfNecessary(_)).
WillRepeatedly(Return(false));
@@ -343,7 +330,6 @@ TEST_F(NewNonFrontendDataTypeControllerTest, AbortDuringAssociation) {
SetStartExpectations();
SetStartFailExpectations(DataTypeController::ABORTED);
- EXPECT_CALL(*dtc_mock_, StartAssociationAsync());
EXPECT_CALL(*change_processor_, Connect(_,_,_,_)).WillOnce(Return(true));
EXPECT_CALL(*change_processor_, CryptoReadyIfNecessary(_)).
WillOnce(Return(true));

Powered by Google App Engine
This is Rietveld 408576698