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_bypa
ss_protocol.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_bypa
ss_protocol.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } | 85 } |
86 | 86 |
87 void SetUp() override { | 87 void SetUp() override { |
88 net::NetworkChangeNotifier::SetTestNotificationsOnly(true); | 88 net::NetworkChangeNotifier::SetTestNotificationsOnly(true); |
89 test_context_ = DataReductionProxyTestContext::Builder().Build(); | 89 test_context_ = DataReductionProxyTestContext::Builder().Build(); |
90 network_change_notifier_.reset(net::NetworkChangeNotifier::CreateMock()); | 90 network_change_notifier_.reset(net::NetworkChangeNotifier::CreateMock()); |
91 test_context_->RunUntilIdle(); | 91 test_context_->RunUntilIdle(); |
92 } | 92 } |
93 | 93 |
94 // Sets up the |TestURLRequestContext| with the provided |ProxyService|. | 94 // Sets up the |TestURLRequestContext| with the provided |ProxyService|. |
95 void ConfigureTestDependencies(ProxyService* proxy_service) { | 95 void ConfigureTestDependencies(scoped_ptr<ProxyService> proxy_service) { |
96 // Create a context with delayed initialization. | 96 // Create a context with delayed initialization. |
97 context_.reset(new TestURLRequestContext(true)); | 97 context_.reset(new TestURLRequestContext(true)); |
98 | 98 |
99 proxy_service_.reset(proxy_service); | 99 proxy_service_ = proxy_service.Pass(); |
100 context_->set_client_socket_factory(&mock_socket_factory_); | 100 context_->set_client_socket_factory(&mock_socket_factory_); |
101 context_->set_proxy_service(proxy_service_.get()); | 101 context_->set_proxy_service(proxy_service_.get()); |
102 network_delegate_.reset(new net::TestNetworkDelegate()); | 102 network_delegate_.reset(new net::TestNetworkDelegate()); |
103 context_->set_network_delegate(network_delegate_.get()); | 103 context_->set_network_delegate(network_delegate_.get()); |
104 // This is needed to prevent the test context from adding language headers | 104 // This is needed to prevent the test context from adding language headers |
105 // to requests. | 105 // to requests. |
106 context_->set_http_user_agent_settings(&http_user_agent_settings_); | 106 context_->set_http_user_agent_settings(&http_user_agent_settings_); |
107 bypass_stats_.reset(new DataReductionProxyBypassStats( | 107 bypass_stats_.reset(new DataReductionProxyBypassStats( |
108 test_context_->config(), | 108 test_context_->config(), |
109 test_context_->unreachable_callback())); | 109 test_context_->unreachable_callback())); |
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 EXPECT_EQ(net::URLRequestStatus::SUCCESS, r->status().status()); | 981 EXPECT_EQ(net::URLRequestStatus::SUCCESS, r->status().status()); |
982 EXPECT_EQ(net::OK, r->status().error()); | 982 EXPECT_EQ(net::OK, r->status().error()); |
983 | 983 |
984 EXPECT_EQ("Bypass message", d.data_received()); | 984 EXPECT_EQ("Bypass message", d.data_received()); |
985 | 985 |
986 // We should have no entries in our bad proxy list. | 986 // We should have no entries in our bad proxy list. |
987 TestBadProxies(0, -1, "", ""); | 987 TestBadProxies(0, -1, "", ""); |
988 } | 988 } |
989 | 989 |
990 } // namespace data_reduction_proxy | 990 } // namespace data_reduction_proxy |
OLD | NEW |