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

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

Issue 653313003: Check effective proxy config before adding data reduction proxies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments on comments Created 6 years, 1 month 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
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_protocol_unittest.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_protocol_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_protocol_unittest.cc
index 09fb1387405bed6402dba32a97e7d1334a06c59c..d6d4e5060aaaae88d3666ecbb05089188472dcad 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_protocol_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_protocol_unittest.cc
@@ -884,6 +884,7 @@ class BadEntropyProvider : public base::FieldTrial::EntropyProvider {
TEST_F(DataReductionProxyProtocolTest, OnResolveProxyHandler) {
int load_flags = net::LOAD_NORMAL;
GURL url("http://www.google.com/");
+ net::ProxyConfig proxy_config_direct = net::ProxyConfig::CreateDirect();
TestDataReductionProxyParams test_params(
DataReductionProxyParams::kAllowed |
@@ -933,13 +934,15 @@ TEST_F(DataReductionProxyProtocolTest, OnResolveProxyHandler) {
// The data reduction proxy is used. It should be used afterwards.
result.Use(data_reduction_proxy_info);
OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config,
- empty_proxy_retry_info, &test_params, &result);
+ proxy_config_direct, empty_proxy_retry_info,
+ &test_params, &result);
EXPECT_EQ(data_reduction_proxy_info.proxy_server(), result.proxy_server());
// Another proxy is used. It should be used afterwards.
result.Use(other_proxy_info);
OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config,
- empty_proxy_retry_info, &test_params, &result);
+ proxy_config_direct, empty_proxy_retry_info,
+ &test_params, &result);
EXPECT_EQ(other_proxy_info.proxy_server(), result.proxy_server());
// A direct connection is used. The data reduction proxy should be used
@@ -948,7 +951,8 @@ TEST_F(DataReductionProxyProtocolTest, OnResolveProxyHandler) {
result.Use(direct_proxy_info);
net::ProxyConfig::ID prev_id = result.config_id();
OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config,
- empty_proxy_retry_info, &test_params, &result);
+ proxy_config_direct, empty_proxy_retry_info,
+ &test_params, &result);
EXPECT_EQ(data_reduction_proxy_info.proxy_server(), result.proxy_server());
// Only the proxy list should be updated, not he proxy info.
EXPECT_EQ(result.config_id(), prev_id);
@@ -958,8 +962,8 @@ TEST_F(DataReductionProxyProtocolTest, OnResolveProxyHandler) {
result.Use(direct_proxy_info);
prev_id = result.config_id();
OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config,
- data_reduction_proxy_retry_info, &test_params,
- &result);
+ proxy_config_direct, data_reduction_proxy_retry_info,
+ &test_params, &result);
EXPECT_TRUE(result.proxy_server().is_direct());
EXPECT_EQ(result.config_id(), prev_id);
@@ -967,25 +971,25 @@ TEST_F(DataReductionProxyProtocolTest, OnResolveProxyHandler) {
// Without DataCompressionProxyCriticalBypass Finch trial set, should never
// bypass.
OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config,
- empty_proxy_retry_info, &test_params,
- &data_reduction_proxy_info);
+ proxy_config_direct, empty_proxy_retry_info,
+ &test_params, &data_reduction_proxy_info);
EXPECT_FALSE(data_reduction_proxy_info.is_direct());
OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config,
- empty_proxy_retry_info, &test_params,
- &other_proxy_info);
+ proxy_config_direct, empty_proxy_retry_info,
+ &test_params, &other_proxy_info);
EXPECT_FALSE(other_proxy_info.is_direct());
load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY;
OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config,
- empty_proxy_retry_info, &test_params,
- &data_reduction_proxy_info);
+ proxy_config_direct, empty_proxy_retry_info,
+ &test_params, &data_reduction_proxy_info);
EXPECT_FALSE(data_reduction_proxy_info.is_direct());
OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config,
- empty_proxy_retry_info, &test_params,
- &other_proxy_info);
+ proxy_config_direct, empty_proxy_retry_info,
+ &test_params, &other_proxy_info);
EXPECT_FALSE(other_proxy_info.is_direct());
// With Finch trial set, should only bypass if LOAD flag is set and the
@@ -999,25 +1003,25 @@ TEST_F(DataReductionProxyProtocolTest, OnResolveProxyHandler) {
load_flags = net::LOAD_NORMAL;
OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config,
- empty_proxy_retry_info, &test_params,
- &data_reduction_proxy_info);
+ proxy_config_direct, empty_proxy_retry_info,
+ &test_params, &data_reduction_proxy_info);
EXPECT_FALSE(data_reduction_proxy_info.is_direct());
OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config,
- empty_proxy_retry_info, &test_params,
- &other_proxy_info);
+ proxy_config_direct, empty_proxy_retry_info,
+ &test_params, &other_proxy_info);
EXPECT_FALSE(other_proxy_info.is_direct());
load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY;
OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config,
- empty_proxy_retry_info, &test_params,
- &other_proxy_info);
+ proxy_config_direct, empty_proxy_retry_info,
+ &test_params, &other_proxy_info);
EXPECT_FALSE(other_proxy_info.is_direct());
OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config,
- empty_proxy_retry_info, &test_params,
- &data_reduction_proxy_info);
+ proxy_config_direct, empty_proxy_retry_info,
+ &test_params, &data_reduction_proxy_info);
EXPECT_TRUE(data_reduction_proxy_info.is_direct());
}
« no previous file with comments | « components/data_reduction_proxy/core/browser/data_reduction_proxy_protocol.cc ('k') | net/proxy/proxy_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698