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

Unified Diff: components/sync/driver/generic_change_processor_unittest.cc

Issue 2399953002: [Sync] Move attachments code out of core/. (Closed)
Patch Set: Address comments. Created 4 years, 2 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 8285630e73fb0542f25c3ae69ee9804ff3c899e7..00188b7a3830b95795626536cea4e226d0c2e065 100644
--- a/components/sync/driver/generic_change_processor_unittest.cc
+++ b/components/sync/driver/generic_change_processor_unittest.cc
@@ -12,13 +12,11 @@
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "components/sync/api/attachments/attachment_id.h"
+#include "components/sync/api/attachments/attachment_service.h"
#include "components/sync/api/data_type_error_handler_mock.h"
#include "components/sync/api/fake_syncable_service.h"
#include "components/sync/api/sync_change.h"
#include "components/sync/base/model_type.h"
-#include "components/sync/core/attachments/attachment_service_impl.h"
-#include "components/sync/core/attachments/fake_attachment_downloader.h"
-#include "components/sync/core/attachments/fake_attachment_uploader.h"
#include "components/sync/core/read_node.h"
#include "components/sync/core/read_transaction.h"
#include "components/sync/core/sync_encryption_handler.h"
@@ -29,6 +27,8 @@
#include "components/sync/device_info/local_device_info_provider.h"
#include "components/sync/driver/fake_sync_client.h"
#include "components/sync/driver/sync_api_component_factory.h"
+#include "components/sync/engine/attachments/fake_attachment_downloader.h"
+#include "components/sync/engine/attachments/fake_attachment_uploader.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -37,40 +37,27 @@ namespace syncer {
namespace {
// A mock that keeps track of attachments passed to UploadAttachments.
-class MockAttachmentService : public AttachmentServiceImpl {
+class MockAttachmentService : public AttachmentService {
public:
- MockAttachmentService(
- std::unique_ptr<AttachmentStoreForSync> attachment_store);
- ~MockAttachmentService() override;
- void UploadAttachments(const AttachmentIdList& attachment_ids) override;
- std::vector<AttachmentIdList>* attachment_id_lists();
+ MockAttachmentService() {}
+ ~MockAttachmentService() override {}
+
+ void GetOrDownloadAttachments(
+ const AttachmentIdList& attachment_ids,
+ const GetOrDownloadCallback& callback) override {}
+
+ void UploadAttachments(const AttachmentIdList& attachment_ids) override {
+ attachment_id_lists_.push_back(attachment_ids);
+ }
+
+ std::vector<AttachmentIdList>* attachment_id_lists() {
+ return &attachment_id_lists_;
+ }
private:
std::vector<AttachmentIdList> attachment_id_lists_;
};
-MockAttachmentService::MockAttachmentService(
- std::unique_ptr<AttachmentStoreForSync> attachment_store)
- : AttachmentServiceImpl(
- std::move(attachment_store),
- std::unique_ptr<AttachmentUploader>(new FakeAttachmentUploader),
- std::unique_ptr<AttachmentDownloader>(new FakeAttachmentDownloader),
- NULL,
- base::TimeDelta(),
- base::TimeDelta()) {}
-
-MockAttachmentService::~MockAttachmentService() {}
-
-void MockAttachmentService::UploadAttachments(
- const AttachmentIdList& attachment_ids) {
- attachment_id_lists_.push_back(attachment_ids);
- AttachmentServiceImpl::UploadAttachments(attachment_ids);
-}
-
-std::vector<AttachmentIdList>* MockAttachmentService::attachment_id_lists() {
- return &attachment_id_lists_;
-}
-
// MockSyncApiComponentFactory needed to initialize GenericChangeProcessor and
// pass MockAttachmentService to it.
class MockSyncApiComponentFactory : public SyncApiComponentFactory {
@@ -112,8 +99,7 @@ class MockSyncApiComponentFactory : public SyncApiComponentFactory {
const std::string& store_birthday,
ModelType model_type,
AttachmentService::Delegate* delegate) override {
- std::unique_ptr<MockAttachmentService> attachment_service(
- new MockAttachmentService(std::move(attachment_store)));
+ auto attachment_service = base::MakeUnique<MockAttachmentService>();
// 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
« no previous file with comments | « components/sync/driver/generic_change_processor.h ('k') | components/sync/driver/shared_change_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698