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

Unified Diff: sync/api/attachments/attachment_service_proxy_for_test.cc

Issue 213003004: Replace calls to 3-arg SyncData::CreateLocalData with 5-arg version. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@syncapi
Patch Set: Forgot a class keyword. 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/attachment_service_proxy_for_test.cc
diff --git a/sync/api/attachments/attachment_service_proxy_for_test.cc b/sync/api/attachments/attachment_service_proxy_for_test.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9ba400bdafd7fec227302778794a2cf16b79a747
--- /dev/null
+++ b/sync/api/attachments/attachment_service_proxy_for_test.cc
@@ -0,0 +1,39 @@
+// 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/api/attachments/attachment_service_proxy_for_test.h"
+
+#include "base/message_loop/message_loop_proxy.h"
+#include "sync/api/attachments/fake_attachment_service.h"
+
+namespace syncer {
+
+// Static.
+scoped_refptr<AttachmentServiceProxyForTest>
+AttachmentServiceProxyForTest::Create() {
+ scoped_ptr<AttachmentService> wrapped(FakeAttachmentService::CreateForTest());
+ // This class's base class, AttachmentServiceProxy, must be initialized with a
+ // WeakPtr to an AttachmentService. Because the base class ctor must be
+ // invoked before any of this class's members are initialized, we create the
+ // WeakPtrFactory here and pass it to the ctor so that it may initialize its
+ // base class and own the WeakPtrFactory.
+ //
+ // We must pass by scoped_ptr because WeakPtrFactory has no copy constructor.
+ scoped_ptr<base::WeakPtrFactory<AttachmentService> > weak_ptr_factory(
+ new base::WeakPtrFactory<AttachmentService>(wrapped.get()));
+ return new AttachmentServiceProxyForTest(wrapped.Pass(),
+ weak_ptr_factory.Pass());
+}
+
+AttachmentServiceProxyForTest::~AttachmentServiceProxyForTest() {}
+
+AttachmentServiceProxyForTest::AttachmentServiceProxyForTest(
+ scoped_ptr<AttachmentService> wrapped,
+ scoped_ptr<base::WeakPtrFactory<AttachmentService> > weak_ptr_factory)
+ : AttachmentServiceProxy(base::MessageLoopProxy::current(),
+ weak_ptr_factory->GetWeakPtr()),
+ wrapped_(wrapped.Pass()),
+ weak_ptr_factory_(weak_ptr_factory.Pass()) {}
+
+} // namespace syncer

Powered by Google App Engine
This is Rietveld 408576698