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

Side by Side 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: Rename GetAttachments to GetLocalAttachmentsForUpload. Created 6 years, 8 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "sync/api/attachments/fake_attachment_service.h"
6
7 #include "base/test/test_simple_task_runner.h"
8 #include "sync/api/attachments/fake_attachment_store.h"
9
10 namespace syncer {
11
12 FakeAttachmentService::FakeAttachmentService(
13 scoped_ptr<AttachmentStore> attachment_store)
14 : attachment_store_(attachment_store.Pass()) {
15 DCHECK(CalledOnValidThread());
16 DCHECK(attachment_store_);
17 }
18
19 FakeAttachmentService::~FakeAttachmentService() {
20 DCHECK(CalledOnValidThread());
21 }
22
23 // Static.
24 scoped_ptr<syncer::AttachmentService> FakeAttachmentService::CreateForTest() {
25 scoped_ptr<syncer::AttachmentStore> attachment_store(
26 new syncer::FakeAttachmentStore(scoped_refptr<base::SequencedTaskRunner>(
27 new base::TestSimpleTaskRunner)));
28 scoped_ptr<syncer::AttachmentService> attachment_service(
29 new syncer::FakeAttachmentService(attachment_store.Pass()));
30 return attachment_service.Pass();
31 }
32
33 void FakeAttachmentService::GetOrDownloadAttachments(
34 const AttachmentIdList& attachment_ids,
35 const GetOrDownloadCallback& callback) {
36 DCHECK(CalledOnValidThread());
37 // TODO(maniscalco): Fire off a bunch of AttachmentStore operations. Invoke
38 // callback after all have completed (bug 356351).
39 }
40
41 void FakeAttachmentService::DropAttachments(
42 const AttachmentIdList& attachment_ids,
43 const DropCallback& callback) {
44 DCHECK(CalledOnValidThread());
45 // TODO(maniscalco): Fire off a bunch of AttachmentStore operations. Invoke
46 // callback after all have completed (bug 356351).
47 }
48
49 void FakeAttachmentService::OnSyncDataAdd(const SyncData& sync_data) {
50 DCHECK(CalledOnValidThread());
51 // TODO(maniscalco): Ensure the linked attachments get persisted in local
52 // storage and schedule them for upload to the server (bug 356351).
53 }
54
55 void FakeAttachmentService::OnSyncDataDelete(const SyncData& sync_data) {
56 DCHECK(CalledOnValidThread());
57 // TODO(maniscalco): One or more of sync_data's attachments may no longer be
58 // referenced anywhere. We should probably delete them at this point (bug
59 // 356351).
60 }
61
62 void FakeAttachmentService::OnSyncDataUpdate(
63 const AttachmentIdList& old_attachment_ids,
64 const SyncData& updated_sync_data) {
65 DCHECK(CalledOnValidThread());
66 // TODO(maniscalco): At this point we need to ensure we write all new
67 // attachments referenced by updated_sync_data to local storage and schedule
68 // them up upload to the server. We also need to remove any no unreferenced
69 // attachments from local storage (bug 356351).
70 }
71
72 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/api/attachments/fake_attachment_service.h ('k') | sync/api/attachments/fake_attachment_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698