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

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

Issue 254713003: sync: don't require a MessageLoopProxy in AttachmentServiceProxyForTest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 6 years, 8 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_service_proxy_for_test.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
index 7f9f873b289b4225e7b4b5696e37afc8fc4e5057..7d03ed8ece1b45b41188dfc860ec919f764a2f6d 100644
--- a/sync/api/attachments/attachment_service_proxy_for_test.cc
+++ b/sync/api/attachments/attachment_service_proxy_for_test.cc
@@ -4,6 +4,7 @@
#include "sync/api/attachments/attachment_service_proxy_for_test.h"
+#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_proxy.h"
#include "sync/api/attachments/fake_attachment_service.h"
@@ -36,8 +37,17 @@ AttachmentServiceProxy AttachmentServiceProxyForTest::Create() {
scoped_refptr<Core> core_for_test(
new OwningCore(wrapped.Pass(), weak_ptr_factory.Pass()));
- return AttachmentServiceProxyForTest(base::MessageLoopProxy::current(),
- core_for_test);
+
+ scoped_refptr<base::SequencedTaskRunner> runner(
+ base::MessageLoopProxy::current());
+ if (!runner) {
+ // Dummy runner for tests that don't care about AttachmentServiceProxy.
+ DVLOG(1) << "Creating dummy MessageLoop for AttachmentServiceProxy.";
+ base::MessageLoop loop;
+ // This works because |runner| takes a ref to the proxy.
+ runner = loop.message_loop_proxy();
+ }
+ return AttachmentServiceProxyForTest(runner, core_for_test);
}
AttachmentServiceProxyForTest::~AttachmentServiceProxyForTest() {
« no previous file with comments | « sync/api/attachments/attachment_service_proxy_for_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698