Skip to content

Commit

Permalink
Remove references of MessageLoopForIO in /jingle
Browse files Browse the repository at this point in the history
MessageLoopForIO will go away soon use ScopedTaskEnvironment instead.

ScopedTaskEnvironment will per default start a ThreadPool, which should
be fine in most of the cases. If you believe your test needs to make sure
that no ThreadPool runs let me know and I will update the patch.

BUG=891670
This CL was uploaded by git cl split.

R=zea@chromium.org

Change-Id: I85626fd1fddb7d36b61b60574b5a6868630d4ed5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1733550
Reviewed-by: Nicolas Zea <zea@chromium.org>
Commit-Queue: Carlos Caballero <carlscab@google.com>
Cr-Commit-Position: refs/heads/master@{#685560}
  • Loading branch information
carlscabgro authored and Commit Bot committed Aug 9, 2019
1 parent 36057dc commit 9798801
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions jingle/notifier/listener/push_client_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#include "base/bind_helpers.h"
#include "base/compiler_specific.h"
#include "base/location.h"
#include "base/message_loop/message_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/test/scoped_task_environment.h"
#include "base/threading/thread.h"
#include "jingle/glue/network_service_config_test_util.h"
#include "jingle/notifier/base/notifier_options.h"
Expand All @@ -27,14 +27,15 @@ class PushClientTest : public testing::Test {
PushClientTest()
: net_config_helper_(
base::MakeRefCounted<net::TestURLRequestContextGetter>(
message_loop_.task_runner())) {
scoped_task_environment_.GetMainThreadTaskRunner())) {
net_config_helper_.FillInNetworkConfig(&notifier_options_.network_config);
}

~PushClientTest() override {}

// The sockets created by the XMPP code expect an IO loop.
base::MessageLoopForIO message_loop_;
base::test::ScopedTaskEnvironment scoped_task_environment_{
base::test::ScopedTaskEnvironment::MainThreadType::IO};
jingle_glue::NetworkServiceConfigTestUtil net_config_helper_;
NotifierOptions notifier_options_;
};
Expand Down
7 changes: 4 additions & 3 deletions jingle/notifier/listener/xmpp_push_client_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include <memory>

#include "base/compiler_specific.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/test/scoped_task_environment.h"
#include "jingle/glue/network_service_config_test_util.h"
#include "jingle/notifier/base/fake_base_task.h"
#include "jingle/notifier/base/notifier_options.h"
Expand Down Expand Up @@ -38,7 +38,7 @@ class XmppPushClientTest : public testing::Test {
XmppPushClientTest()
: net_config_helper_(
base::MakeRefCounted<net::TestURLRequestContextGetter>(
message_loop_.task_runner())) {
scoped_task_environment_.GetMainThreadTaskRunner())) {
net_config_helper_.FillInNetworkConfig(&notifier_options_.network_config);
}

Expand All @@ -57,7 +57,8 @@ class XmppPushClientTest : public testing::Test {
}

// The sockets created by the XMPP code expect an IO loop.
base::MessageLoopForIO message_loop_;
base::test::ScopedTaskEnvironment scoped_task_environment_{
base::test::ScopedTaskEnvironment::MainThreadType::IO};

jingle_glue::NetworkServiceConfigTestUtil net_config_helper_;
NotifierOptions notifier_options_;
Expand Down

0 comments on commit 9798801

Please sign in to comment.