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

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

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: Merge with master. 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.h
diff --git a/sync/api/attachments/attachment_service_proxy_for_test.h b/sync/api/attachments/attachment_service_proxy_for_test.h
new file mode 100644
index 0000000000000000000000000000000000000000..b9ed05b62c68505d18958d5113b860bf2c2d7442
--- /dev/null
+++ b/sync/api/attachments/attachment_service_proxy_for_test.h
@@ -0,0 +1,42 @@
+// 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_ATTACHMENT_SERVICE_PROXY_FOR_TEST_H_
+#define SYNC_API_ATTACHMENTS_ATTACHMENT_SERVICE_PROXY_FOR_TEST_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "sync/api/attachments/attachment_service_proxy.h"
+#include "sync/base/sync_export.h"
+
+namespace syncer {
+
+// Helper class to implement "base from member" idiom.
+//
+// Logically private to AttachmentServiceProxyForTest.
+class SYNC_EXPORT AttachmentServiceProxyForTestMember {
+ protected:
+ scoped_ptr<AttachmentService> wrapped_;
+ base::WeakPtrFactory<AttachmentService> wrapped_weak_ptr_factory_;
+ explicit AttachmentServiceProxyForTestMember(
+ scoped_ptr<AttachmentService> wrapped);
+ virtual ~AttachmentServiceProxyForTestMember();
+};
+
+// An AttachmentServiceProxy to reduce boilerplate code in tests.
+//
+// Constructs and owns an AttachmentService suitable for use in tests. Assumes
+// the current thread has a MessageLoop.
+class SYNC_EXPORT AttachmentServiceProxyForTest
+ : private AttachmentServiceProxyForTestMember,
+ public AttachmentServiceProxy {
+ public:
+ // Default copy and assignment are welcome.
+ AttachmentServiceProxyForTest();
+ virtual ~AttachmentServiceProxyForTest();
+};
+
+} // namespace syncer
+
+#endif // SYNC_API_ATTACHMENTS_ATTACHMENT_SERVICE_PROXY_FOR_TEST_H_

Powered by Google App Engine
This is Rietveld 408576698