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

Unified Diff: sync/api/attachments/fake_attachment_service.h

Issue 187303006: Update sync API to support attachments. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@attachmentapi
Patch Set: Fix enum related compile errors on mac. Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: sync/api/attachments/fake_attachment_service.h
diff --git a/sync/api/attachments/fake_attachment_service.h b/sync/api/attachments/fake_attachment_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..8ea7212c0b7dd3ff4bfd875079dff53610770f09
--- /dev/null
+++ b/sync/api/attachments/fake_attachment_service.h
@@ -0,0 +1,48 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SYNC_API_ATTACHMENTS_FAKE_ATTACHMENT_SERVICE_H_
+#define SYNC_API_ATTACHMENTS_FAKE_ATTACHMENT_SERVICE_H_
+
+#include "base/memory/weak_ptr.h"
+#include "base/threading/non_thread_safe.h"
+#include "sync/api/attachments/attachment_service.h"
+#include "sync/api/attachments/attachment_store.h"
+
+namespace syncer {
+
+// A fake implementation of AttachmentService.
+class SYNC_EXPORT FakeAttachmentService : public AttachmentService,
+ public base::NonThreadSafe {
+ public:
+ explicit FakeAttachmentService(scoped_ptr<AttachmentStore> attachment_store);
+ virtual ~FakeAttachmentService();
+
+ // Create a FakeAttachmentService suitable for use in tests.
+ static scoped_ptr<syncer::AttachmentService> CreateForTest();
+
+ // AttachmentService implementation.
+ virtual void GetOrDownloadAttachments(const AttachmentIdList& attachment_ids,
+ const GetOrDownloadCallback& callback)
+ OVERRIDE;
+ virtual void DropAttachments(const AttachmentIdList& attachment_ids,
+ const DropCallback& callback) OVERRIDE;
+ virtual void OnSyncDataAdd(const SyncData& sync_data) OVERRIDE;
+ virtual void OnSyncDataDelete(const SyncData& sync_data) OVERRIDE;
+ virtual void OnSyncDataUpdate(const AttachmentIdList& old_attachment_ids,
+ const SyncData& updated_sync_data) OVERRIDE;
+ virtual base::WeakPtr<AttachmentService> AsWeakPtr() OVERRIDE;
+
+ private:
+ const scoped_ptr<AttachmentStore> attachment_store_;
+
+ // Must be last data member.
+ base::WeakPtrFactory<AttachmentService> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakeAttachmentService);
+};
+
+} // namespace syncer
+
+#endif // SYNC_API_ATTACHMENTS_FAKE_ATTACHMENT_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698