Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc

Issue 2386813003: Use net::TestNetworkQualityEstimator for data reduction proxy tests (Closed)
Patch Set: ps Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc ('k') | net/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc
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 3fe3fce5cdb21aa1350acf4c099628ad8d80818f..86063221003ab963f83345952d02640f98b9e5b4 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
@@ -44,6 +44,7 @@
#include "net/http/http_util.h"
#include "net/nqe/effective_connection_type.h"
#include "net/nqe/network_quality_estimator.h"
+#include "net/nqe/network_quality_estimator_test_util.h"
#include "net/proxy/proxy_config.h"
#include "net/proxy/proxy_info.h"
#include "net/proxy/proxy_retry_info.h"
@@ -141,28 +142,6 @@ class TestLoFiUIService : public LoFiUIService {
bool on_lofi_response_;
};
-// Overrides net::NetworkQualityEstimator for testing.
-class TestNetworkQualityEstimator : public net::NetworkQualityEstimator {
- public:
- TestNetworkQualityEstimator(
- const std::map<std::string, std::string>& variation_params,
- net::EffectiveConnectionType effective_connection_type)
- : NetworkQualityEstimator(
- std::unique_ptr<net::ExternalEstimateProvider>(),
- variation_params),
- effective_connection_type_(effective_connection_type) {}
-
- ~TestNetworkQualityEstimator() override {}
-
- net::EffectiveConnectionType GetEffectiveConnectionType() const override {
- return effective_connection_type_;
- }
-
- private:
- // Estimate of the quality of the network.
- net::EffectiveConnectionType effective_connection_type_;
-};
-
class DataReductionProxyNetworkDelegateTest : public testing::Test {
public:
DataReductionProxyNetworkDelegateTest()
@@ -533,8 +512,9 @@ TEST_F(DataReductionProxyNetworkDelegateTest, RequestDataConfigurations) {
net::ProxyRetryInfoMap proxy_retry_info;
std::map<std::string, std::string> network_quality_estimator_params;
- TestNetworkQualityEstimator test_network_quality_estimator(
- network_quality_estimator_params,
+ net::TestNetworkQualityEstimator test_network_quality_estimator(
+ network_quality_estimator_params);
+ test_network_quality_estimator.set_effective_connection_type(
net::EFFECTIVE_CONNECTION_TYPE_OFFLINE);
context()->set_network_quality_estimator(&test_network_quality_estimator);
@@ -621,8 +601,10 @@ TEST_F(DataReductionProxyNetworkDelegateTest, RedirectRequestDataCleared) {
net::ProxyRetryInfoMap proxy_retry_info;
std::map<std::string, std::string> network_quality_estimator_params;
- TestNetworkQualityEstimator test_network_quality_estimator(
- network_quality_estimator_params, net::EFFECTIVE_CONNECTION_TYPE_OFFLINE);
+ net::TestNetworkQualityEstimator test_network_quality_estimator(
+ network_quality_estimator_params);
+ test_network_quality_estimator.set_effective_connection_type(
+ net::EFFECTIVE_CONNECTION_TYPE_OFFLINE);
context()->set_network_quality_estimator(&test_network_quality_estimator);
std::unique_ptr<net::URLRequest> request = context()->CreateRequest(
« no previous file with comments | « components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc ('k') | net/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698