OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_inte
rceptor.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_inte
rceptor.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 109 } |
110 | 110 |
111 ~TestURLRequestContextWithDataReductionProxy() override {} | 111 ~TestURLRequestContextWithDataReductionProxy() override {} |
112 }; | 112 }; |
113 | 113 |
114 class DataReductionProxyInterceptorTest : public testing::Test { | 114 class DataReductionProxyInterceptorTest : public testing::Test { |
115 public: | 115 public: |
116 DataReductionProxyInterceptorTest() { | 116 DataReductionProxyInterceptorTest() { |
117 test_context_ = | 117 test_context_ = |
118 DataReductionProxyTestContext::Builder() | 118 DataReductionProxyTestContext::Builder() |
119 .WithParamsFlags(0) | |
120 .WithParamsDefinitions(TestDataReductionProxyParams::HAS_EVERYTHING) | |
121 .Build(); | 119 .Build(); |
122 default_context_.reset(new TestURLRequestContextWithDataReductionProxy( | 120 default_context_.reset(new TestURLRequestContextWithDataReductionProxy( |
123 test_context_->config() | 121 test_context_->config() |
124 ->test_params() | 122 ->test_params() |
125 ->proxies_for_http() | 123 ->proxies_for_http() |
126 .front() | 124 .front() |
127 .proxy_server(), | 125 .proxy_server(), |
128 &default_network_delegate_)); | 126 &default_network_delegate_)); |
129 default_context_->set_network_delegate(&default_network_delegate_); | 127 default_context_->set_network_delegate(&default_network_delegate_); |
130 default_context_->set_net_log(test_context_->net_log()); | 128 default_context_->set_net_log(test_context_->net_log()); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 proxy_file_path = root_path.AppendASCII( | 206 proxy_file_path = root_path.AppendASCII( |
209 "components/test/data/data_reduction_proxy/proxy"); | 207 "components/test/data/data_reduction_proxy/proxy"); |
210 direct_file_path = root_path.AppendASCII( | 208 direct_file_path = root_path.AppendASCII( |
211 "components/test/data/data_reduction_proxy/direct"); | 209 "components/test/data/data_reduction_proxy/direct"); |
212 proxy_.ServeFilesFromDirectory(proxy_file_path); | 210 proxy_.ServeFilesFromDirectory(proxy_file_path); |
213 direct_.ServeFilesFromDirectory(direct_file_path); | 211 direct_.ServeFilesFromDirectory(direct_file_path); |
214 ASSERT_TRUE(proxy_.Start()); | 212 ASSERT_TRUE(proxy_.Start()); |
215 ASSERT_TRUE(direct_.Start()); | 213 ASSERT_TRUE(direct_.Start()); |
216 | 214 |
217 test_context_ = DataReductionProxyTestContext::Builder() | 215 test_context_ = DataReductionProxyTestContext::Builder() |
218 .WithParamsFlags(0) | |
219 .WithURLRequestContext(&context_) | 216 .WithURLRequestContext(&context_) |
220 .Build(); | 217 .Build(); |
221 std::string spec; | 218 std::string spec; |
222 base::TrimString(proxy_.GetURL("/").spec(), "/", &spec); | 219 base::TrimString(proxy_.GetURL("/").spec(), "/", &spec); |
223 net::ProxyServer origin = | 220 net::ProxyServer origin = |
224 net::ProxyServer::FromURI(spec, net::ProxyServer::SCHEME_HTTP); | 221 net::ProxyServer::FromURI(spec, net::ProxyServer::SCHEME_HTTP); |
225 std::vector<DataReductionProxyServer> proxies_for_http; | 222 std::vector<DataReductionProxyServer> proxies_for_http; |
226 proxies_for_http.push_back( | 223 proxies_for_http.push_back( |
227 DataReductionProxyServer(origin, ProxyServer::UNSPECIFIED_TYPE)); | 224 DataReductionProxyServer(origin, ProxyServer::UNSPECIFIED_TYPE)); |
228 test_context_->config()->test_params()->SetProxiesForHttp(proxies_for_http); | 225 test_context_->config()->test_params()->SetProxiesForHttp(proxies_for_http); |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 std::vector<GURL> expected_url_chain; | 584 std::vector<GURL> expected_url_chain; |
588 expected_url_chain.push_back(GURL("http://music.google.com")); | 585 expected_url_chain.push_back(GURL("http://music.google.com")); |
589 expected_url_chain.push_back(GURL("http://play.google.com")); | 586 expected_url_chain.push_back(GURL("http://play.google.com")); |
590 expected_url_chain.push_back(GURL("https://play.google.com")); | 587 expected_url_chain.push_back(GURL("https://play.google.com")); |
591 EXPECT_EQ(expected_url_chain, request->url_chain()); | 588 EXPECT_EQ(expected_url_chain, request->url_chain()); |
592 } | 589 } |
593 | 590 |
594 } // namespace | 591 } // namespace |
595 | 592 |
596 } // namespace data_reduction_proxy | 593 } // namespace data_reduction_proxy |
OLD | NEW |