Chromium Code Reviews| 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..2cf56b142be22e8c1fdeb186f068461f268e6bc1 |
| --- /dev/null |
| +++ b/sync/api/attachments/attachment_service_proxy_for_test.h |
| @@ -0,0 +1,40 @@ |
| +// 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 { |
| + |
| +// An self-contained 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 |
| + : public AttachmentServiceProxy { |
| + public: |
| + static scoped_refptr<AttachmentServiceProxyForTest> Create(); |
|
tim (not reviewing)
2014/04/07 20:23:10
I see. Sad face. In this case I still think the m
maniscalco
2014/04/08 17:51:57
I like this approach. Done. ASP is no longer RCT
|
| + |
| + private: |
| + scoped_ptr<AttachmentService> wrapped_; |
| + // WeakPtrFactory for wrapped_. See Create() for why this is a scoped_ptr. |
| + scoped_ptr<base::WeakPtrFactory<AttachmentService> > weak_ptr_factory_; |
| + |
| + AttachmentServiceProxyForTest( |
| + scoped_ptr<AttachmentService>, |
| + scoped_ptr<base::WeakPtrFactory<AttachmentService> > weak_ptr_factory); |
| + |
| + virtual ~AttachmentServiceProxyForTest(); |
| + |
| + DISALLOW_COPY_AND_ASSIGN(AttachmentServiceProxyForTest); |
| +}; |
| + |
| +} // namespace syncer |
| + |
| +#endif // SYNC_API_ATTACHMENTS_ATTACHMENT_SERVICE_PROXY_FOR_TEST_H_ |