diff options
author | skyostil <skyostil@chromium.org> | 2015-04-27 10:59:37 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-27 17:59:35 +0000 |
commit | 0becb33779f8678e2703d6ff1a73ce2b45571f98 (patch) | |
tree | ca8e900931a5e71c07db40c308a7755b15de1870 /components/data_reduction_proxy | |
parent | 6974bf71b37bddb36ca8b1feefc013b7c47c105f (diff) | |
download | chromium_src-0becb33779f8678e2703d6ff1a73ce2b45571f98.zip chromium_src-0becb33779f8678e2703d6ff1a73ce2b45571f98.tar.gz chromium_src-0becb33779f8678e2703d6ff1a73ce2b45571f98.tar.bz2 |
Ensure tests have an active task runner
This patch modifies all tests to have a more realistic threading set-up by either:
a) adding a TestBrowserThreadBundle
b) constructing any existing TestBrowserThreadBundle earlier or
c) adding a MessageLoop as appropriate.
This makes it possible to later migrate base/ from MessageLoopProxy over to
ThreadTaskRunnerHandle, which requires an active task runner on the current thread.
BUG=465354
Review URL: https://codereview.chromium.org/1086733002
Cr-Commit-Position: refs/heads/master@{#327067}
Diffstat (limited to 'components/data_reduction_proxy')
15 files changed, 18 insertions, 8 deletions
diff --git a/components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_resource_throttle_unittest.cc b/components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_resource_throttle_unittest.cc index e7e3789..7845c05 100644 --- a/components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_resource_throttle_unittest.cc +++ b/components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_resource_throttle_unittest.cc @@ -105,6 +105,7 @@ class DataReductionProxyDebugResourceThrottleTest : public testing::Test { } private: + base::MessageLoop message_loop_; net::TestURLRequestContext context_; net::TestDelegate delegate_; // |test_job_interceptor_| is owned by |test_job_factory_|. diff --git a/components/data_reduction_proxy/content/browser/data_reduction_proxy_message_filter_unittest.cc b/components/data_reduction_proxy/content/browser/data_reduction_proxy_message_filter_unittest.cc index ab2252b..eef60db 100644 --- a/components/data_reduction_proxy/content/browser/data_reduction_proxy_message_filter_unittest.cc +++ b/components/data_reduction_proxy/content/browser/data_reduction_proxy_message_filter_unittest.cc @@ -38,6 +38,7 @@ class DataReductionProxyMessageFilterTest : public testing::Test { } private: + base::MessageLoopForIO message_loop_; scoped_ptr<DataReductionProxyTestContext> test_context_; scoped_refptr<DataReductionProxyMessageFilter> message_filter_; }; diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc index 0934c3e..d6f2da6 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc @@ -311,6 +311,7 @@ class DataReductionProxyProtocolTest : public testing::Test { } protected: + base::MessageLoopForIO message_loop_; scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; scoped_ptr<net::URLRequestInterceptor> simple_interceptor_; diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc index cc1930e..bf1345e 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc @@ -130,6 +130,7 @@ class DataReductionProxyBypassStatsTest : public testing::Test { } private: + base::MessageLoopForIO message_loop_; net::TestURLRequestContext context_; net::TestDelegate delegate_; scoped_ptr<net::URLRequest> mock_url_request_; @@ -704,6 +705,7 @@ class DataReductionProxyBypassStatsEndToEndTest : public testing::Test { } private: + base::MessageLoopForIO message_loop_; net::TestDelegate delegate_; net::MockClientSocketFactory mock_socket_factory_; net::TestURLRequestContext context_; diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client_unittest.cc index 19ec5f4..ca35828 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client_unittest.cc @@ -146,6 +146,7 @@ class DataReductionProxyConfigServiceClientTest : public testing::Test { } private: + base::MessageLoopForIO message_loop_; net::TestURLRequestContext context_; net::MockClientSocketFactory mock_socket_factory_; diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc index 6dfb7b8..504d956 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc @@ -179,6 +179,7 @@ class DataReductionProxyConfigTest : public testing::Test { } private: + base::MessageLoopForIO message_loop_; scoped_ptr<DataReductionProxyTestContext> test_context_; scoped_ptr<TestDataReductionProxyParams> expected_params_; }; diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator_unittest.cc index d669dcd..9d9972b 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator_unittest.cc @@ -50,6 +50,7 @@ class DataReductionProxyConfiguratorTest : public testing::Test { } } + base::MessageLoop message_loop_; scoped_ptr<DataReductionProxyTestContext> test_context_; scoped_ptr<DataReductionProxyConfigurator> config_; }; diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc index b4189e2..a7e2965 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc @@ -131,6 +131,7 @@ class DataReductionProxyInterceptorTest : public testing::Test { default_context_->Init(); } + base::MessageLoopForIO message_loop_; scoped_ptr<DataReductionProxyTestContext> test_context_; net::TestNetworkDelegate default_network_delegate_; scoped_ptr<net::URLRequestJobFactory> job_factory_; @@ -235,6 +236,7 @@ class DataReductionProxyInterceptorWithServerTest : public testing::Test { } private: + base::MessageLoopForIO message_loop_; net::TestNetLog net_log_; net::TestNetworkDelegate network_delegate_; net::TestURLRequestContext context_; @@ -329,6 +331,7 @@ class DataReductionProxyInterceptorEndToEndTest : public testing::Test { } private: + base::MessageLoopForIO message_loop_; net::TestDelegate delegate_; net::MockClientSocketFactory mock_socket_factory_; net::TestURLRequestContext context_; diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_metrics_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_metrics_unittest.cc index be48a2a..5c44a5f 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_metrics_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_metrics_unittest.cc @@ -26,6 +26,7 @@ namespace data_reduction_proxy { TEST(ChromeNetworkDailyDataSavingMetricsTest, GetDataReductionProxyRequestType) { + base::MessageLoopForIO message_loop; scoped_ptr<DataReductionProxyTestContext> test_context = DataReductionProxyTestContext::Builder() .WithParamsFlags(DataReductionProxyParams::kAllowed) diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc index c96c862..b35c401 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc @@ -147,6 +147,7 @@ class DataReductionProxyNetworkDelegateTest : public testing::Test { data_reduction_proxy_network_delegate_; private: + base::MessageLoopForIO message_loop_; net::TestURLRequestContext context_; net::TestDelegate delegate_; // |test_job_interceptor_| is owned by |test_job_factory_|. diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options_unittest.cc index 4ea8a9a..eb7f5b5 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options_unittest.cc @@ -174,6 +174,7 @@ class DataReductionProxyRequestOptionsTest : public testing::Test { EXPECT_EQ(expected_header, header_value); } + base::MessageLoopForIO message_loop_; scoped_ptr<TestDataReductionProxyRequestOptions> request_options_; scoped_ptr<DataReductionProxyTestContext> test_context_; }; diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.h index 3df3671..dc5ec7f 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.h +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.h @@ -83,6 +83,7 @@ class DataReductionProxySettingsTestBase : public testing::Test { return true; } + base::MessageLoopForIO message_loop_; scoped_ptr<DataReductionProxyTestContext> test_context_; scoped_ptr<DataReductionProxySettings> settings_; base::Time last_update_time_; diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc index dce4f0a..0bcc780 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc @@ -143,6 +143,7 @@ TEST_F(DataReductionProxySettingsTest, TestContentLengths) { } TEST(DataReductionProxySettingsStandaloneTest, TestEndToEndSecureProxyCheck) { + base::MessageLoopForIO message_loop; struct TestCase { const char* response_headers; const char* response_body; @@ -215,6 +216,7 @@ TEST(DataReductionProxySettingsStandaloneTest, TestEndToEndSecureProxyCheck) { } TEST(DataReductionProxySettingsStandaloneTest, TestOnProxyEnabledPrefChange) { + base::MessageLoopForIO message_loop; scoped_ptr<DataReductionProxyTestContext> drp_test_context = DataReductionProxyTestContext::Builder() .WithParamsFlags(DataReductionProxyParams::kAllowed | diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc index f070f13..c784796 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc @@ -4,7 +4,6 @@ #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h" -#include "base/message_loop/message_loop.h" #include "base/prefs/testing_pref_service.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.h" @@ -293,7 +292,6 @@ scoped_ptr<DataReductionProxyTestContext> DataReductionProxyTestContext::Builder::Build() { // Check for invalid builder combinations. DCHECK(!(use_mock_config_ && use_config_client_)); - scoped_ptr<base::MessageLoopForIO> loop(new base::MessageLoopForIO()); unsigned int test_context_flags = 0; scoped_refptr<base::SingleThreadTaskRunner> task_runner = @@ -394,7 +392,7 @@ DataReductionProxyTestContext::Builder::Build() { scoped_ptr<DataReductionProxyTestContext> test_context( new DataReductionProxyTestContext( - loop.Pass(), task_runner, pref_service.Pass(), net_log.Pass(), + task_runner, pref_service.Pass(), net_log.Pass(), request_context_getter, mock_socket_factory_, io_data.Pass(), settings.Pass(), storage_delegate.Pass(), raw_params, test_context_flags)); @@ -406,7 +404,6 @@ DataReductionProxyTestContext::Builder::Build() { } DataReductionProxyTestContext::DataReductionProxyTestContext( - scoped_ptr<base::MessageLoop> loop, scoped_refptr<base::SingleThreadTaskRunner> task_runner, scoped_ptr<TestingPrefServiceSimple> simple_pref_service, scoped_ptr<net::TestNetLog> net_log, @@ -418,7 +415,6 @@ DataReductionProxyTestContext::DataReductionProxyTestContext( TestDataReductionProxyParams* params, unsigned int test_context_flags) : test_context_flags_(test_context_flags), - loop_(loop.Pass()), task_runner_(task_runner), simple_pref_service_(simple_pref_service.Pass()), net_log_(net_log.Pass()), diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h index e5c4ca0..e199098 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h @@ -386,7 +386,6 @@ class DataReductionProxyTestContext { }; DataReductionProxyTestContext( - scoped_ptr<base::MessageLoop> loop, scoped_refptr<base::SingleThreadTaskRunner> task_runner, scoped_ptr<TestingPrefServiceSimple> simple_pref_service, scoped_ptr<net::TestNetLog> net_log, @@ -405,8 +404,6 @@ class DataReductionProxyTestContext { unsigned int test_context_flags_; - scoped_ptr<base::MessageLoop> loop_; - scoped_refptr<base::SingleThreadTaskRunner> task_runner_; scoped_ptr<TestingPrefServiceSimple> simple_pref_service_; scoped_ptr<net::TestNetLog> net_log_; |