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

Side by Side Diff: sync/api/attachments/fake_attachment_service.h

Issue 263903004: Add AttachmentUploader interface and fake implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SYNC_API_ATTACHMENTS_FAKE_ATTACHMENT_SERVICE_H_ 5 #ifndef SYNC_API_ATTACHMENTS_FAKE_ATTACHMENT_SERVICE_H_
6 #define SYNC_API_ATTACHMENTS_FAKE_ATTACHMENT_SERVICE_H_ 6 #define SYNC_API_ATTACHMENTS_FAKE_ATTACHMENT_SERVICE_H_
7 7
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/threading/non_thread_safe.h" 9 #include "base/threading/non_thread_safe.h"
10 #include "sync/api/attachments/attachment_service.h" 10 #include "sync/api/attachments/attachment_service.h"
11 #include "sync/api/attachments/attachment_service_proxy.h" 11 #include "sync/api/attachments/attachment_service_proxy.h"
12 #include "sync/api/attachments/attachment_store.h" 12 #include "sync/api/attachments/attachment_store.h"
13 #include "sync/api/attachments/attachment_uploader.h"
13 14
14 namespace syncer { 15 namespace syncer {
15 16
16 // A fake implementation of AttachmentService. 17 // A fake implementation of AttachmentService.
17 class SYNC_EXPORT FakeAttachmentService : public AttachmentService, 18 class SYNC_EXPORT FakeAttachmentService : public AttachmentService,
18 public base::NonThreadSafe { 19 public base::NonThreadSafe {
19 public: 20 public:
20 explicit FakeAttachmentService(scoped_ptr<AttachmentStore> attachment_store); 21 FakeAttachmentService(scoped_ptr<AttachmentStore> attachment_store,
22 scoped_ptr<AttachmentUploader> attachment_uploader);
21 virtual ~FakeAttachmentService(); 23 virtual ~FakeAttachmentService();
22 24
23 // Create a FakeAttachmentService suitable for use in tests. 25 // Create a FakeAttachmentService suitable for use in tests.
24 static scoped_ptr<syncer::AttachmentService> CreateForTest(); 26 static scoped_ptr<syncer::AttachmentService> CreateForTest();
25 27
26 // AttachmentService implementation. 28 // AttachmentService implementation.
27 virtual void GetOrDownloadAttachments(const AttachmentIdList& attachment_ids, 29 virtual void GetOrDownloadAttachments(const AttachmentIdList& attachment_ids,
28 const GetOrDownloadCallback& callback) 30 const GetOrDownloadCallback& callback)
29 OVERRIDE; 31 OVERRIDE;
30 virtual void DropAttachments(const AttachmentIdList& attachment_ids, 32 virtual void DropAttachments(const AttachmentIdList& attachment_ids,
31 const DropCallback& callback) OVERRIDE; 33 const DropCallback& callback) OVERRIDE;
32 virtual void StoreAttachments(const AttachmentList& attachments, 34 virtual void StoreAttachments(const AttachmentList& attachments,
33 const StoreCallback& callback) OVERRIDE; 35 const StoreCallback& callback) OVERRIDE;
34 virtual void OnSyncDataDelete(const SyncData& sync_data) OVERRIDE; 36 virtual void OnSyncDataDelete(const SyncData& sync_data) OVERRIDE;
35 virtual void OnSyncDataUpdate(const AttachmentIdList& old_attachment_ids, 37 virtual void OnSyncDataUpdate(const AttachmentIdList& old_attachment_ids,
36 const SyncData& updated_sync_data) OVERRIDE; 38 const SyncData& updated_sync_data) OVERRIDE;
37 39
38 private: 40 private:
39 void ReadDone(const GetOrDownloadCallback& callback, 41 void ReadDone(const GetOrDownloadCallback& callback,
40 const AttachmentStore::Result& result, 42 const AttachmentStore::Result& result,
41 scoped_ptr<AttachmentMap> attachments); 43 scoped_ptr<AttachmentMap> attachments);
42 void DropDone(const DropCallback& callback, 44 void DropDone(const DropCallback& callback,
43 const AttachmentStore::Result& result); 45 const AttachmentStore::Result& result);
44 void WriteDone(const StoreCallback& callback, 46 void WriteDone(const StoreCallback& callback,
45 const AttachmentStore::Result& result); 47 const AttachmentStore::Result& result);
46 48
47 const scoped_ptr<AttachmentStore> attachment_store_; 49 const scoped_ptr<AttachmentStore> attachment_store_;
50 const scoped_ptr<AttachmentUploader> attachment_uploader_;
48 // Must be last data member. 51 // Must be last data member.
49 base::WeakPtrFactory<FakeAttachmentService> weak_ptr_factory_; 52 base::WeakPtrFactory<FakeAttachmentService> weak_ptr_factory_;
50 53
51 DISALLOW_COPY_AND_ASSIGN(FakeAttachmentService); 54 DISALLOW_COPY_AND_ASSIGN(FakeAttachmentService);
52 }; 55 };
53 56
54 } // namespace syncer 57 } // namespace syncer
55 58
56 #endif // SYNC_API_ATTACHMENTS_FAKE_ATTACHMENT_SERVICE_H_ 59 #endif // SYNC_API_ATTACHMENTS_FAKE_ATTACHMENT_SERVICE_H_
OLDNEW
« no previous file with comments | « sync/api/attachments/attachment_uploader.cc ('k') | sync/api/attachments/fake_attachment_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698