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 #ifndef SYNC_API_ATTACHMENTS_FAKE_ATTACHMENT_SERVICE_H_ |
| 6 #define SYNC_API_ATTACHMENTS_FAKE_ATTACHMENT_SERVICE_H_ |
| 7 |
| 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/threading/non_thread_safe.h" |
| 10 #include "sync/api/attachments/attachment_service.h" |
| 11 #include "sync/api/attachments/attachment_store.h" |
| 12 |
| 13 namespace syncer { |
| 14 |
| 15 // A fake implementation of AttachmentService. |
| 16 class SYNC_EXPORT FakeAttachmentService : public AttachmentService, |
| 17 public base::NonThreadSafe { |
| 18 public: |
| 19 explicit FakeAttachmentService(scoped_ptr<AttachmentStore> attachment_store); |
| 20 virtual ~FakeAttachmentService(); |
| 21 |
| 22 // Create a FakeAttachmentService suitable for use in tests. |
| 23 static scoped_ptr<syncer::AttachmentService> CreateForTest(); |
| 24 |
| 25 // AttachmentService implementation. |
| 26 virtual void GetOrDownloadAttachments(const AttachmentIdList& attachment_ids, |
| 27 const GetOrDownloadCallback& callback) |
| 28 OVERRIDE; |
| 29 virtual void DropAttachments(const AttachmentIdList& attachment_ids, |
| 30 const DropCallback& callback) OVERRIDE; |
| 31 virtual void OnSyncDataAdd(const SyncData& sync_data) OVERRIDE; |
| 32 virtual void OnSyncDataDelete(const SyncData& sync_data) OVERRIDE; |
| 33 virtual void OnSyncDataUpdate(const AttachmentIdList& old_attachment_ids, |
| 34 const SyncData& updated_sync_data) OVERRIDE; |
| 35 virtual base::WeakPtr<AttachmentService> AsWeakPtr() OVERRIDE; |
| 36 |
| 37 private: |
| 38 const scoped_ptr<AttachmentStore> attachment_store_; |
| 39 |
| 40 // Must be last data member. |
| 41 base::WeakPtrFactory<AttachmentService> weak_ptr_factory_; |
| 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(FakeAttachmentService); |
| 44 }; |
| 45 |
| 46 } // namespace syncer |
| 47 |
| 48 #endif // SYNC_API_ATTACHMENTS_FAKE_ATTACHMENT_SERVICE_H_ |
OLD | NEW |