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

Unified Diff: sync/internal_api/attachments/fake_attachment_downloader.cc

Issue 296153014: AttachmentDownloader implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: sync/internal_api/attachments/fake_attachment_downloader.cc
diff --git a/sync/internal_api/attachments/fake_attachment_downloader.cc b/sync/internal_api/attachments/fake_attachment_downloader.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1f2795e7dfdd849c42e122f13de4c907068555a3
--- /dev/null
+++ b/sync/internal_api/attachments/fake_attachment_downloader.cc
@@ -0,0 +1,34 @@
+// 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.
+
+#include "sync/internal_api/public/attachments/fake_attachment_downloader.h"
+
+#include "base/bind.h"
+#include "base/message_loop/message_loop.h"
+
+namespace syncer {
+
+FakeAttachmentDownloader::FakeAttachmentDownloader() {
+}
+
+FakeAttachmentDownloader::~FakeAttachmentDownloader() {
+ DCHECK(CalledOnValidThread());
+}
+
+void FakeAttachmentDownloader::DownloadAttachment(
+ const AttachmentId& attachment_id,
+ const DownloadCallback& callback) {
+ DCHECK(CalledOnValidThread());
+ // This is happy fake downloader, it always successfully downloads empty
+ // attachment.
+ scoped_refptr<base::RefCountedMemory> data(new base::RefCountedBytes());
+ scoped_ptr<Attachment> attachment;
+ attachment.reset(
+ new Attachment(Attachment::CreateWithId(attachment_id, data)));
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(callback, DOWNLOAD_SUCCESS, base::Passed(&attachment)));
+}
+
+} // namespace syncer

Powered by Google App Engine
This is Rietveld 408576698