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(attachment_store_); |
| 16 } |
| 17 |
| 18 FakeAttachmentService::~FakeAttachmentService() {} |
| 19 |
| 20 // Static. |
| 21 scoped_ptr<syncer::AttachmentService> FakeAttachmentService::CreateForTest() { |
| 22 scoped_ptr<syncer::AttachmentStore> attachment_store( |
| 23 new syncer::FakeAttachmentStore(scoped_refptr<base::SequencedTaskRunner>( |
| 24 new base::TestSimpleTaskRunner))); |
| 25 scoped_ptr<syncer::AttachmentService> attachment_service( |
| 26 new syncer::FakeAttachmentService(attachment_store.Pass())); |
| 27 return attachment_service.Pass(); |
| 28 } |
| 29 |
| 30 void FakeAttachmentService::GetAttachments( |
| 31 const AttachmentIdList& attachment_ids, |
| 32 const GetCallback& callback) { |
| 33 NOTIMPLEMENTED(); |
| 34 } |
| 35 |
| 36 void FakeAttachmentService::DropAttachments( |
| 37 const AttachmentIdList& attachment_ids, |
| 38 const DropCallback& callback) { |
| 39 NOTIMPLEMENTED(); |
| 40 } |
| 41 |
| 42 void FakeAttachmentService::OnSyncDataAdd(const SyncData& sync_data) { |
| 43 NOTIMPLEMENTED(); |
| 44 |
| 45 // TODO(maniscalco): Ensure the linked attachments get persisted in local |
| 46 // storage and schedule them for upload to the server. |
| 47 } |
| 48 |
| 49 void FakeAttachmentService::OnSyncDataDelete(const SyncData& sync_data) { |
| 50 NOTIMPLEMENTED(); |
| 51 |
| 52 // TODO(maniscalco): One or more of sync_data's attachments may no longer be |
| 53 // referenced anywhere. We should probably delete them at this point. |
| 54 } |
| 55 |
| 56 void FakeAttachmentService::OnSyncDataUpdate( |
| 57 const AttachmentIdList& old_attachment_ids, |
| 58 const SyncData& updated_sync_data) { |
| 59 NOTIMPLEMENTED(); |
| 60 |
| 61 // TODO(maniscalco): At this point we need to ensure we write all new |
| 62 // attachments referenced by updated_sync_data to local storage and schedule |
| 63 // them up upload to the server. We also need to remove any no unreferenced |
| 64 // attachments from local storage. |
| 65 } |
| 66 |
| 67 } // namespace syncer |
OLD | NEW |