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

Unified Diff: chrome/browser/sync/glue/shared_change_processor_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/shared_change_processor_unittest.cc
diff --git a/chrome/browser/sync/glue/shared_change_processor_unittest.cc b/chrome/browser/sync/glue/shared_change_processor_unittest.cc
index 4a6f5fae3ab2c974c328662360237cef6e538cc2..8279cdf33036f1d9ff52ab2d0359684e9c51f7a1 100644
--- a/chrome/browser/sync/glue/shared_change_processor_unittest.cc
+++ b/chrome/browser/sync/glue/shared_change_processor_unittest.cc
@@ -10,7 +10,7 @@
#include "base/bind_helpers.h"
#include "base/compiler_specific.h"
#include "base/message_loop.h"
-#include "chrome/browser/sync/api/syncable_service_mock.h"
+#include "chrome/browser/sync/api/fake_syncable_service.h"
#include "chrome/browser/sync/profile_sync_components_factory_mock.h"
#include "chrome/browser/sync/glue/data_type_error_handler_mock.h"
#include "chrome/browser/sync/profile_sync_components_factory_impl.h"
@@ -41,7 +41,7 @@ class SyncSharedChangeProcessorTest : public testing::Test {
db_syncable_service_(NULL) {}
virtual ~SyncSharedChangeProcessorTest() {
- EXPECT_FALSE(db_syncable_service_);
+ EXPECT_FALSE(db_syncable_service_.get());
}
protected:
@@ -85,16 +85,15 @@ class SyncSharedChangeProcessorTest : public testing::Test {
// Used by SetUp().
void SetUpDBSyncableService() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
- DCHECK(!db_syncable_service_);
- db_syncable_service_ = new NiceMock<SyncableServiceMock>();
+ DCHECK(!db_syncable_service_.get());
+ db_syncable_service_.reset(new FakeSyncableService());
}
// Used by TearDown().
void TearDownDBSyncableService() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
- DCHECK(db_syncable_service_);
- delete db_syncable_service_;
- db_syncable_service_ = NULL;
+ DCHECK(db_syncable_service_.get());
+ db_syncable_service_.reset();
}
// Used by Connect(). The SharedChangeProcessor is passed in
@@ -104,7 +103,7 @@ class SyncSharedChangeProcessorTest : public testing::Test {
const scoped_refptr<SharedChangeProcessor>& shared_change_processor) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
EXPECT_CALL(sync_factory_, GetSyncableServiceForType(syncable::AUTOFILL)).
- WillOnce(GetWeakPtrToSyncableService(db_syncable_service_));
+ WillOnce(GetWeakPtrToSyncableService(db_syncable_service_.get()));
EXPECT_TRUE(shared_change_processor->Connect(&sync_factory_,
&sync_service_,
&error_handler_,
@@ -121,7 +120,7 @@ class SyncSharedChangeProcessorTest : public testing::Test {
StrictMock<DataTypeErrorHandlerMock> error_handler_;
// Used only on DB thread.
- NiceMock<SyncableServiceMock>* db_syncable_service_;
+ scoped_ptr<FakeSyncableService> db_syncable_service_;
};
// Simply connect the shared change processor. It should succeed, and

Powered by Google App Engine
This is Rietveld 408576698