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

Unified Diff: components/sync_driver/generic_change_processor_unittest.cc

Issue 548373003: Move AttachmentStore ownership to datatype (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Changes after feedback. Created 6 years, 3 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: components/sync_driver/generic_change_processor_unittest.cc
diff --git a/components/sync_driver/generic_change_processor_unittest.cc b/components/sync_driver/generic_change_processor_unittest.cc
index f1b35e6afc5e11657ab66a6f41c5ec89198547de..73bd92dda54d2e2af13bd7d58a8684abe5fc57cc 100644
--- a/components/sync_driver/generic_change_processor_unittest.cc
+++ b/components/sync_driver/generic_change_processor_unittest.cc
@@ -38,7 +38,8 @@ const char kTestData[] = "some data";
// A mock that keeps track of attachments passed to UploadAttachments.
class MockAttachmentService : public syncer::AttachmentServiceImpl {
public:
- MockAttachmentService();
+ MockAttachmentService(
+ const scoped_refptr<syncer::AttachmentStore>& attachment_store);
virtual ~MockAttachmentService();
virtual void UploadAttachments(
const syncer::AttachmentIdSet& attachment_ids) OVERRIDE;
@@ -48,15 +49,14 @@ class MockAttachmentService : public syncer::AttachmentServiceImpl {
std::vector<syncer::AttachmentIdSet> attachment_id_sets_;
};
-MockAttachmentService::MockAttachmentService()
- : AttachmentServiceImpl(
- scoped_ptr<syncer::AttachmentStore>(new syncer::FakeAttachmentStore(
- base::MessageLoopProxy::current())),
- scoped_ptr<syncer::AttachmentUploader>(
- new syncer::FakeAttachmentUploader),
- scoped_ptr<syncer::AttachmentDownloader>(
- new syncer::FakeAttachmentDownloader),
- NULL) {
+MockAttachmentService::MockAttachmentService(
+ const scoped_refptr<syncer::AttachmentStore>& attachment_store)
+ : AttachmentServiceImpl(attachment_store,
+ scoped_ptr<syncer::AttachmentUploader>(
+ new syncer::FakeAttachmentUploader),
+ scoped_ptr<syncer::AttachmentDownloader>(
+ new syncer::FakeAttachmentDownloader),
+ NULL) {
}
MockAttachmentService::~MockAttachmentService() {
@@ -89,6 +89,7 @@ class MockSyncApiComponentFactory : public SyncApiComponentFactory {
}
virtual scoped_ptr<syncer::AttachmentService> CreateAttachmentService(
+ const scoped_refptr<syncer::AttachmentStore>& attachment_store,
const syncer::UserShare& user_share,
syncer::AttachmentService::Delegate* delegate) OVERRIDE {
EXPECT_TRUE(attachment_service_ != NULL);
@@ -119,8 +120,11 @@ class SyncGenericChangeProcessorTest : public testing::Test {
test_user_share_.user_share());
}
test_user_share_.encryption_handler()->Init();
+ scoped_refptr<syncer::AttachmentStore> attachment_store(
+ new syncer::FakeAttachmentStore(base::MessageLoopProxy::current()));
+
scoped_ptr<MockAttachmentService> mock_attachment_service(
- new MockAttachmentService);
+ new MockAttachmentService(attachment_store));
// GenericChangeProcessor takes ownership of the AttachmentService, but we
// need to have a pointer to it so we can see that it was used properly.
// Take a pointer and trust that GenericChangeProcessor does not prematurely
@@ -133,7 +137,8 @@ class SyncGenericChangeProcessorTest : public testing::Test {
syncable_service_ptr_factory_.GetWeakPtr(),
merge_result_ptr_factory_.GetWeakPtr(),
test_user_share_.user_share(),
- sync_factory_.get()));
+ sync_factory_.get(),
+ attachment_store));
}
virtual void TearDown() OVERRIDE {
« no previous file with comments | « components/sync_driver/generic_change_processor_factory.cc ('k') | components/sync_driver/shared_change_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698