Commit 69ca206c authored by Ryan Sturm's avatar Ryan Sturm Committed by Commit Bot

Moving DataReductionProxyInterceptorEndToEndTest to ScopedTaskEnvironment

Bug: 773747
Change-Id: I01059b4f7e5b64821b2215136f217cf175d2160c
Reviewed-on: https://chromium-review.googlesource.com/804148Reviewed-by: default avatarFrançois Doray <fdoray@chromium.org>
Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
Commit-Queue: Tarun Bansal <tbansal@chromium.org>
Commit-Queue: Ryan Sturm <ryansturm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521461}
parent 08d5e289
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.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/test/histogram_tester.h" #include "base/test/histogram_tester.h"
#include "base/test/scoped_task_environment.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h"
...@@ -113,7 +113,9 @@ class TestURLRequestContextWithDataReductionProxy ...@@ -113,7 +113,9 @@ class TestURLRequestContextWithDataReductionProxy
class DataReductionProxyInterceptorTest : public testing::Test { class DataReductionProxyInterceptorTest : public testing::Test {
public: public:
DataReductionProxyInterceptorTest() { DataReductionProxyInterceptorTest()
: scoped_task_environment_(
base::test::ScopedTaskEnvironment::MainThreadType::IO) {
test_context_ = test_context_ =
DataReductionProxyTestContext::Builder() DataReductionProxyTestContext::Builder()
.Build(); .Build();
...@@ -140,7 +142,9 @@ class DataReductionProxyInterceptorTest : public testing::Test { ...@@ -140,7 +142,9 @@ class DataReductionProxyInterceptorTest : public testing::Test {
default_context_->Init(); default_context_->Init();
} }
base::MessageLoopForIO message_loop_; protected:
base::test::ScopedTaskEnvironment scoped_task_environment_;
std::unique_ptr<DataReductionProxyTestContext> test_context_; std::unique_ptr<DataReductionProxyTestContext> test_context_;
net::TestNetworkDelegate default_network_delegate_; net::TestNetworkDelegate default_network_delegate_;
std::unique_ptr<net::URLRequestJobFactory> job_factory_; std::unique_ptr<net::URLRequestJobFactory> job_factory_;
...@@ -190,7 +194,9 @@ TEST_F(DataReductionProxyInterceptorTest, MAYBE_TestJobFactoryChaining) { ...@@ -190,7 +194,9 @@ TEST_F(DataReductionProxyInterceptorTest, MAYBE_TestJobFactoryChaining) {
class DataReductionProxyInterceptorWithServerTest : public testing::Test { class DataReductionProxyInterceptorWithServerTest : public testing::Test {
public: public:
DataReductionProxyInterceptorWithServerTest() DataReductionProxyInterceptorWithServerTest()
: context_(true) { : scoped_task_environment_(
base::test::ScopedTaskEnvironment::MainThreadType::IO),
context_(true) {
context_.set_network_delegate(&network_delegate_); context_.set_network_delegate(&network_delegate_);
context_.set_net_log(&net_log_); context_.set_net_log(&net_log_);
} }
...@@ -245,8 +251,10 @@ class DataReductionProxyInterceptorWithServerTest : public testing::Test { ...@@ -245,8 +251,10 @@ class DataReductionProxyInterceptorWithServerTest : public testing::Test {
const net::EmbeddedTestServer& direct() { return direct_; } const net::EmbeddedTestServer& direct() { return direct_; }
protected:
base::test::ScopedTaskEnvironment scoped_task_environment_;
private: private:
base::MessageLoopForIO message_loop_;
net::TestNetLog net_log_; net::TestNetLog net_log_;
net::TestNetworkDelegate network_delegate_; net::TestNetworkDelegate network_delegate_;
net::TestURLRequestContext context_; net::TestURLRequestContext context_;
...@@ -289,7 +297,10 @@ TEST_F(DataReductionProxyInterceptorWithServerTest, TestNoBypass) { ...@@ -289,7 +297,10 @@ TEST_F(DataReductionProxyInterceptorWithServerTest, TestNoBypass) {
class DataReductionProxyInterceptorEndToEndTest : public testing::Test { class DataReductionProxyInterceptorEndToEndTest : public testing::Test {
public: public:
DataReductionProxyInterceptorEndToEndTest() DataReductionProxyInterceptorEndToEndTest()
: context_(true), context_storage_(&context_) {} : scoped_task_environment_(
base::test::ScopedTaskEnvironment::MainThreadType::IO),
context_(true),
context_storage_(&context_) {}
~DataReductionProxyInterceptorEndToEndTest() override {} ~DataReductionProxyInterceptorEndToEndTest() override {}
...@@ -338,8 +349,10 @@ class DataReductionProxyInterceptorEndToEndTest : public testing::Test { ...@@ -338,8 +349,10 @@ class DataReductionProxyInterceptorEndToEndTest : public testing::Test {
return config()->test_params()->proxies_for_http().front().proxy_server(); return config()->test_params()->proxies_for_http().front().proxy_server();
} }
protected:
base::test::ScopedTaskEnvironment scoped_task_environment_;
private: private:
base::MessageLoopForIO message_loop_;
net::TestDelegate delegate_; net::TestDelegate delegate_;
net::MockClientSocketFactory mock_socket_factory_; net::MockClientSocketFactory mock_socket_factory_;
net::TestURLRequestContext context_; net::TestURLRequestContext context_;
......
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