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

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

Issue 619563002: Revert of Refactor FakeAttachmentStore (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « sync/api/attachments/attachment_store.cc ('k') | sync/api/attachments/fake_attachment_store.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/api/attachments/fake_attachment_store.h
diff --git a/sync/api/attachments/fake_attachment_store.h b/sync/api/attachments/fake_attachment_store.h
new file mode 100644
index 0000000000000000000000000000000000000000..9ac7006e7e5de469bfe793b03c569deb5901e9ed
--- /dev/null
+++ b/sync/api/attachments/fake_attachment_store.h
@@ -0,0 +1,60 @@
+// 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_STORE_H_
+#define SYNC_API_ATTACHMENTS_FAKE_ATTACHMENT_STORE_H_
+
+#include <map>
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/stl_util.h"
+#include "sync/api/attachments/attachment_store.h"
+#include "sync/base/sync_export.h"
+
+namespace base {
+class SequencedTaskRunner;
+class SingleThreadTaskRunner;
+} // namespace base
+
+namespace sync_pb {
+class AttachmentId;
+} // namespace sync_pb
+
+namespace syncer {
+
+class Attachment;
+
+// A in-memory only implementation of AttachmentStore used for testing.
+//
+// Requires that the current thread has a MessageLoop.
+class SYNC_EXPORT FakeAttachmentStore : public AttachmentStore {
+ public:
+ // Construct a FakeAttachmentStore whose "IO" will be performed in
+ // |backend_task_runner|.
+ explicit FakeAttachmentStore(
+ const scoped_refptr<base::SequencedTaskRunner>& backend_task_runner);
+
+ // AttachmentStore implementation.
+ virtual void Read(const AttachmentIdList& id,
+ const ReadCallback& callback) OVERRIDE;
+ virtual void Write(const AttachmentList& attachments,
+ const WriteCallback& callback) OVERRIDE;
+ virtual void Drop(const AttachmentIdList& id,
+ const DropCallback& callback) OVERRIDE;
+
+ private:
+ class Backend;
+
+ virtual ~FakeAttachmentStore();
+
+ scoped_refptr<Backend> backend_;
+ scoped_refptr<base::SequencedTaskRunner> backend_task_runner_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakeAttachmentStore);
+};
+
+} // namespace syncer
+
+#endif // SYNC_API_ATTACHMENTS_FAKE_ATTACHMENT_STORE_H_
« no previous file with comments | « sync/api/attachments/attachment_store.cc ('k') | sync/api/attachments/fake_attachment_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698