diff options
author | dbeam <dbeam@chromium.org> | 2015-04-17 18:46:21 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-18 01:46:34 +0000 |
commit | 73792940074b018fef612268e0255be32f67ee78 (patch) | |
tree | da7070685ed20162510d26beace77140d2a9c671 /components/data_reduction_proxy | |
parent | 6cce97b7253c3f4815e5f87da8d691f50ab412e9 (diff) | |
download | chromium_src-73792940074b018fef612268e0255be32f67ee78.zip chromium_src-73792940074b018fef612268e0255be32f67ee78.tar.gz chromium_src-73792940074b018fef612268e0255be32f67ee78.tar.bz2 |
Combine multiple BadEntropyProviders into base::MockEntropyProvider.
R=phajdan.jr@chromium.org
TBR=jeremyim@chromium.org
BUG=none
TEST=less code
Review URL: https://codereview.chromium.org/1050863004
Cr-Commit-Position: refs/heads/master@{#325755}
Diffstat (limited to 'components/data_reduction_proxy')
3 files changed, 6 insertions, 33 deletions
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 1753b38..c638bdd 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 @@ -11,6 +11,7 @@ #include "base/metrics/field_trial.h" #include "base/run_loop.h" #include "base/strings/stringprintf.h" +#include "base/test/mock_entropy_provider.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.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_interceptor.h" @@ -62,16 +63,6 @@ class SimpleURLRequestInterceptor : public net::URLRequestInterceptor { } }; -class BadEntropyProvider : public base::FieldTrial::EntropyProvider { - public: - ~BadEntropyProvider() override {} - - double GetEntropyForTrial(const std::string& trial_name, - uint32 randomization_seed) const override { - return 0.5; - } -}; - // Constructs a |TestURLRequestContext| that uses a |MockSocketFactory| to // simulate requests and responses. class DataReductionProxyProtocolTest : public testing::Test { @@ -784,7 +775,7 @@ TEST_F(DataReductionProxyProtocolTest, std::string primary = test_context_->config()->test_params()->DefaultOrigin(); std::string fallback = test_context_->config()->test_params()->DefaultFallbackOrigin(); - base::FieldTrialList field_trial_list(new BadEntropyProvider()); + base::FieldTrialList field_trial_list(new base::MockEntropyProvider()); base::FieldTrialList::CreateFieldTrial( "DataReductionProxyRemoveMissingViaHeaderOtherBypass", "Relaxed"); 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 2556ed2..c96c862 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 @@ -7,6 +7,7 @@ #include "base/metrics/field_trial.h" #include "base/strings/string_number_conversions.h" #include "base/test/histogram_tester.h" +#include "base/test/mock_entropy_provider.h" #include "base/time/time.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_metrics.h" @@ -245,16 +246,6 @@ TEST_F(DataReductionProxyNetworkDelegateTest, NetHistograms) { kResponseContentLength, 1); } -class BadEntropyProvider : public base::FieldTrial::EntropyProvider { - public: - ~BadEntropyProvider() override {} - - double GetEntropyForTrial(const std::string& trial_name, - uint32 randomization_seed) const override { - return 0.5; - } -}; - TEST_F(DataReductionProxyNetworkDelegateTest, OnResolveProxyHandler) { int load_flags = net::LOAD_NORMAL; GURL url("http://www.google.com/"); @@ -365,7 +356,7 @@ TEST_F(DataReductionProxyNetworkDelegateTest, OnResolveProxyHandler) { // With Finch trial set, should only bypass if LOAD flag is set and the // effective proxy is the data compression proxy. - base::FieldTrialList field_trial_list(new BadEntropyProvider()); + base::FieldTrialList field_trial_list(new base::MockEntropyProvider()); base::FieldTrialList::CreateFieldTrial("DataCompressionProxyCriticalBypass", "Enabled"); EXPECT_TRUE( 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 1d64a4c..2b1a17b 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 @@ -7,6 +7,7 @@ #include "base/command_line.h" #include "base/md5.h" #include "base/metrics/field_trial.h" +#include "base/test/mock_entropy_provider.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_test_utils.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator_test_utils.h" @@ -23,16 +24,6 @@ namespace data_reduction_proxy { -class BadEntropyProvider : public base::FieldTrial::EntropyProvider { - public: - ~BadEntropyProvider() override {} - - double GetEntropyForTrial(const std::string& trial_name, - uint32 randomization_seed) const override { - return 0.5; - } -}; - class DataReductionProxySettingsTest : public ConcreteDataReductionProxySettingsTest< DataReductionProxySettings> { @@ -425,7 +416,7 @@ TEST_F(DataReductionProxySettingsTest, CheckQUICFieldTrials) { test_context_->pref_service(), test_context_->io_data(), test_context_->CreateDataReductionProxyService()); - base::FieldTrialList field_trial_list(new BadEntropyProvider()); + base::FieldTrialList field_trial_list(new base::MockEntropyProvider()); if (enable_quic) { base::FieldTrialList::CreateFieldTrial( DataReductionProxyParams::GetQuicFieldTrialName(), |