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

Unified Diff: sync/api/attachments/fake_attachment_service.cc

Issue 187303006: Update sync API to support attachments. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@attachmentapi
Patch Set: Pull in upstream changes. Created 6 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: sync/api/attachments/fake_attachment_service.cc
diff --git a/sync/api/attachments/fake_attachment_service.cc b/sync/api/attachments/fake_attachment_service.cc
new file mode 100644
index 0000000000000000000000000000000000000000..74f37a086a3556c129197d8bd9fd508b4ab7b59a
--- /dev/null
+++ b/sync/api/attachments/fake_attachment_service.cc
@@ -0,0 +1,67 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "sync/api/attachments/fake_attachment_service.h"
+
+#include "base/test/test_simple_task_runner.h"
+#include "sync/api/attachments/fake_attachment_store.h"
+
+namespace syncer {
+
+FakeAttachmentService::FakeAttachmentService(
+ scoped_ptr<AttachmentStore> attachment_store)
+ : attachment_store_(attachment_store.Pass()) {
+ DCHECK(attachment_store_);
+}
+
+FakeAttachmentService::~FakeAttachmentService() {}
+
+// Static.
+scoped_ptr<syncer::AttachmentService> FakeAttachmentService::CreateForTest() {
+ scoped_ptr<syncer::AttachmentStore> attachment_store(
+ new syncer::FakeAttachmentStore(scoped_refptr<base::SequencedTaskRunner>(
+ new base::TestSimpleTaskRunner)));
+ scoped_ptr<syncer::AttachmentService> attachment_service(
+ new syncer::FakeAttachmentService(attachment_store.Pass()));
+ return attachment_service.Pass();
+}
+
+void FakeAttachmentService::GetAttachments(
+ const AttachmentIdList& attachment_ids,
+ const GetCallback& callback) {
+ NOTIMPLEMENTED();
+}
+
+void FakeAttachmentService::DropAttachments(
+ const AttachmentIdList& attachment_ids,
+ const DropCallback& callback) {
+ NOTIMPLEMENTED();
+}
+
+void FakeAttachmentService::OnSyncDataAdd(const SyncData& sync_data) {
+ NOTIMPLEMENTED();
+
+ // TODO(maniscalco): Ensure the linked attachments get persisted in local
+ // storage and schedule them for upload to the server.
+}
+
+void FakeAttachmentService::OnSyncDataDelete(const SyncData& sync_data) {
+ NOTIMPLEMENTED();
+
+ // TODO(maniscalco): One or more of sync_data's attachments may no longer be
+ // referenced anywhere. We should probably delete them at this point.
+}
+
+void FakeAttachmentService::OnSyncDataUpdate(
+ const AttachmentIdList& old_attachment_ids,
+ const SyncData& updated_sync_data) {
+ NOTIMPLEMENTED();
+
+ // TODO(maniscalco): At this point we need to ensure we write all new
+ // attachments referenced by updated_sync_data to local storage and schedule
+ // them up upload to the server. We also need to remove any no unreferenced
+ // attachments from local storage.
+}
+
+} // namespace syncer

Powered by Google App Engine
This is Rietveld 408576698