Commit d38fe9f0 authored by Carlos Caballero's avatar Carlos Caballero Committed by Commit Bot

Remove references of MessageLoopForIO in /chrome/service

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=rbpotter@chromium.org

Change-Id: I6488b766455b858343b2ca9b953027f001a077d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1733496
Auto-Submit: Carlos Caballero <carlscab@google.com>
Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683792}
parent 3056fec0
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/location.h" #include "base/location.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/synchronization/waitable_event.h" #include "base/synchronization/waitable_event.h"
#include "base/test/scoped_task_environment.h"
#include "base/threading/thread.h" #include "base/threading/thread.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "base/values.h" #include "base/values.h"
...@@ -139,7 +139,8 @@ class CloudPrintURLFetcherTest : public testing::Test, ...@@ -139,7 +139,8 @@ class CloudPrintURLFetcherTest : public testing::Test,
// we assume that the current thread is the IO thread where the URLFetcher // we assume that the current thread is the IO thread where the URLFetcher
// dispatches its requests to. When we wish to simulate being used from // dispatches its requests to. When we wish to simulate being used from
// a UI thread, we dispatch a worker thread to do so. // a UI thread, we dispatch a worker thread to do so.
base::MessageLoopForIO io_loop_; base::test::ScopedTaskEnvironment scoped_task_environment_{
base::test::ScopedTaskEnvironment::MainThreadType::IO};
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
int max_retries_; int max_retries_;
Time start_time_; Time start_time_;
......
...@@ -11,11 +11,11 @@ ...@@ -11,11 +11,11 @@
#include "base/hash/md5.h" #include "base/hash/md5.h"
#include "base/location.h" #include "base/location.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/test/bind_test_util.h" #include "base/test/bind_test_util.h"
#include "base/test/scoped_task_environment.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "chrome/common/cloud_print/cloud_print_constants.h" #include "chrome/common/cloud_print/cloud_print_constants.h"
#include "chrome/service/cloud_print/cloud_print_service_helpers.h" #include "chrome/service/cloud_print/cloud_print_service_helpers.h"
...@@ -464,7 +464,8 @@ class PrinterJobHandlerTest : public ::testing::Test { ...@@ -464,7 +464,8 @@ class PrinterJobHandlerTest : public ::testing::Test {
void BeginTest(int timeout_seconds); void BeginTest(int timeout_seconds);
void MakeJobFetchReturnNoJobs(); void MakeJobFetchReturnNoJobs();
base::MessageLoopForIO loop_; base::test::ScopedTaskEnvironment scoped_task_environment_{
base::test::ScopedTaskEnvironment::MainThreadType::IO};
base::OnceClosure active_run_loop_quit_closure_; base::OnceClosure active_run_loop_quit_closure_;
TestURLFetcherCallback url_callback_; TestURLFetcherCallback url_callback_;
MockPrinterJobHandlerDelegate jobhandler_delegate_; MockPrinterJobHandlerDelegate jobhandler_delegate_;
...@@ -765,7 +766,7 @@ TEST_F(PrinterJobHandlerTest, DISABLED_ManyFailureTest) { ...@@ -765,7 +766,7 @@ TEST_F(PrinterJobHandlerTest, DISABLED_ManyFailureTest) {
net::HTTP_INTERNAL_SERVER_ERROR, net::HTTP_INTERNAL_SERVER_ERROR,
net::URLRequestStatus::FAILED); net::URLRequestStatus::FAILED);
loop_.task_runner()->PostDelayedTask( scoped_task_environment_.GetMainThreadTaskRunner()->PostDelayedTask(
FROM_HERE, FROM_HERE,
base::BindOnce(&net::FakeURLFetcherFactory::SetFakeResponse, base::BindOnce(&net::FakeURLFetcherFactory::SetFakeResponse,
base::Unretained(&factory_), TicketURI(1), base::Unretained(&factory_), TicketURI(1),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment