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

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

Issue 792803007: Make Data Reduction Proxy a best effort proxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated tests Created 5 years, 11 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
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 b277d46b185c42a9629f48a03446fce1fdbfe7c0..63a5490376c4ac6d05298b069868905ad7c0ad7c 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
@@ -818,7 +818,6 @@ 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 |
@@ -868,15 +867,13 @@ 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,
- proxy_config_direct, empty_proxy_retry_info,
- &test_params, &result);
+ 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,
- proxy_config_direct, empty_proxy_retry_info,
- &test_params, &result);
+ 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
@@ -885,8 +882,7 @@ 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,
- proxy_config_direct, empty_proxy_retry_info,
- &test_params, &result);
+ 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);
@@ -896,57 +892,43 @@ TEST_F(DataReductionProxyProtocolTest, OnResolveProxyHandler) {
result.Use(direct_proxy_info);
prev_id = result.config_id();
OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config,
- proxy_config_direct, data_reduction_proxy_retry_info,
- &test_params, &result);
+ data_reduction_proxy_retry_info, &test_params, &result);
EXPECT_TRUE(result.proxy_server().is_direct());
EXPECT_EQ(result.config_id(), prev_id);
// Test that ws:// and wss:// URLs bypass the data reduction proxy.
+ result.UseDirect();
OnResolveProxyHandler(GURL("ws://echo.websocket.org/"),
load_flags, data_reduction_proxy_config,
- proxy_config_direct, empty_proxy_retry_info,
- &test_params, &other_proxy_info);
- EXPECT_FALSE(other_proxy_info.is_direct());
-
- OnResolveProxyHandler(GURL("ws://echo.websocket.org/"),
- load_flags, data_reduction_proxy_config,
- proxy_config_direct, empty_proxy_retry_info,
- &test_params, &data_reduction_proxy_info);
- EXPECT_TRUE(data_reduction_proxy_info.is_direct());
-
- OnResolveProxyHandler(GURL("wss://echo.websocket.org/"),
- load_flags, data_reduction_proxy_config,
- proxy_config_direct, empty_proxy_retry_info,
- &test_params, &other_proxy_info);
- EXPECT_FALSE(other_proxy_info.is_direct());
+ empty_proxy_retry_info, &test_params, &result);
+ EXPECT_TRUE(result.is_direct());
OnResolveProxyHandler(GURL("wss://echo.websocket.org/"),
load_flags, data_reduction_proxy_config,
- proxy_config_direct, empty_proxy_retry_info,
- &test_params, &data_reduction_proxy_info);
- EXPECT_TRUE(data_reduction_proxy_info.is_direct());
+ empty_proxy_retry_info, &test_params, &result);
+ EXPECT_TRUE(result.is_direct());
// Without DataCompressionProxyCriticalBypass Finch trial set, the
// BYPASS_DATA_REDUCTION_PROXY load flag should be ignored.
OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config,
- proxy_config_direct, empty_proxy_retry_info,
- &test_params, &data_reduction_proxy_info);
+ 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,
- proxy_config_direct, empty_proxy_retry_info,
+ 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,
- proxy_config_direct, empty_proxy_retry_info,
- &test_params, &data_reduction_proxy_info);
+ 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,
- proxy_config_direct, empty_proxy_retry_info,
+ empty_proxy_retry_info,
&test_params, &other_proxy_info);
EXPECT_FALSE(other_proxy_info.is_direct());
@@ -961,25 +943,25 @@ TEST_F(DataReductionProxyProtocolTest, OnResolveProxyHandler) {
load_flags = net::LOAD_NORMAL;
OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config,
- proxy_config_direct, empty_proxy_retry_info,
- &test_params, &data_reduction_proxy_info);
+ 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,
- proxy_config_direct, empty_proxy_retry_info,
- &test_params, &other_proxy_info);
+ 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,
- proxy_config_direct, empty_proxy_retry_info,
- &test_params, &other_proxy_info);
+ empty_proxy_retry_info, &test_params,
+ &other_proxy_info);
EXPECT_FALSE(other_proxy_info.is_direct());
OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config,
- proxy_config_direct, empty_proxy_retry_info,
- &test_params, &data_reduction_proxy_info);
+ empty_proxy_retry_info, &test_params,
+ &data_reduction_proxy_info);
EXPECT_TRUE(data_reduction_proxy_info.is_direct());
}

Powered by Google App Engine
This is Rietveld 408576698