OLD | NEW |
(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 |
OLD | NEW |