OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 "net/http/http_stream_factory_impl_job_controller.h" | 5 #include "net/http/http_stream_factory_impl_job_controller.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 } | 119 } |
120 | 120 |
121 void Initialize(bool use_alternative_proxy) { | 121 void Initialize(bool use_alternative_proxy) { |
122 std::unique_ptr<TestProxyDelegate> test_proxy_delegate( | 122 std::unique_ptr<TestProxyDelegate> test_proxy_delegate( |
123 new TestProxyDelegate()); | 123 new TestProxyDelegate()); |
124 test_proxy_delegate_ = test_proxy_delegate.get(); | 124 test_proxy_delegate_ = test_proxy_delegate.get(); |
125 | 125 |
126 test_proxy_delegate->set_alternative_proxy_server( | 126 test_proxy_delegate->set_alternative_proxy_server( |
127 ProxyServer::FromPacString("QUIC myproxy.org:443")); | 127 ProxyServer::FromPacString("QUIC myproxy.org:443")); |
128 EXPECT_TRUE(test_proxy_delegate->alternative_proxy_server().is_quic()); | 128 EXPECT_TRUE(test_proxy_delegate->alternative_proxy_server().is_quic()); |
129 session_deps_.proxy_delegate.reset(test_proxy_delegate.release()); | 129 session_deps_.proxy_delegate = std::move(test_proxy_delegate); |
130 | 130 |
131 if (use_alternative_proxy) { | 131 if (use_alternative_proxy) { |
132 std::unique_ptr<ProxyService> proxy_service = | 132 std::unique_ptr<ProxyService> proxy_service = |
133 ProxyService::CreateFixedFromPacResult("HTTPS myproxy.org:443"); | 133 ProxyService::CreateFixedFromPacResult("HTTPS myproxy.org:443"); |
134 session_deps_.proxy_service.reset(proxy_service.release()); | 134 session_deps_.proxy_service = std::move(proxy_service); |
135 } | 135 } |
136 session_ = SpdySessionDependencies::SpdyCreateSession(&session_deps_); | 136 session_ = SpdySessionDependencies::SpdyCreateSession(&session_deps_); |
137 factory_ = | 137 factory_ = |
138 static_cast<HttpStreamFactoryImpl*>(session_->http_stream_factory()); | 138 static_cast<HttpStreamFactoryImpl*>(session_->http_stream_factory()); |
139 job_controller_ = new HttpStreamFactoryImpl::JobController( | 139 job_controller_ = new HttpStreamFactoryImpl::JobController( |
140 factory_, &request_delegate_, session_.get(), &job_factory_); | 140 factory_, &request_delegate_, session_.get(), &job_factory_); |
141 HttpStreamFactoryImplPeer::AddJobController(factory_, job_controller_); | 141 HttpStreamFactoryImplPeer::AddJobController(factory_, job_controller_); |
142 } | 142 } |
143 | 143 |
144 TestProxyDelegate* test_proxy_delegate() const { | 144 TestProxyDelegate* test_proxy_delegate() const { |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 // Reset the request as it's been successfully served. | 947 // Reset the request as it's been successfully served. |
948 request_.reset(); | 948 request_.reset(); |
949 EXPECT_TRUE(HttpStreamFactoryImplPeer::IsJobControllerDeleted(factory_)); | 949 EXPECT_TRUE(HttpStreamFactoryImplPeer::IsJobControllerDeleted(factory_)); |
950 | 950 |
951 histogram_tester.ExpectUniqueSample("Net.QuicAlternativeProxy.Usage", | 951 histogram_tester.ExpectUniqueSample("Net.QuicAlternativeProxy.Usage", |
952 2 /* ALTERNATIVE_PROXY_USAGE_LOST_RACE */, | 952 2 /* ALTERNATIVE_PROXY_USAGE_LOST_RACE */, |
953 1); | 953 1); |
954 } | 954 } |
955 | 955 |
956 } // namespace net | 956 } // namespace net |
OLD | NEW |