| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 SendRequestAndExpectQuicResponseMaybeFromProxy(expected, false); | 287 SendRequestAndExpectQuicResponseMaybeFromProxy(expected, false); |
| 288 } | 288 } |
| 289 | 289 |
| 290 void SendRequestAndExpectQuicResponseFromProxy(const std::string& expected) { | 290 void SendRequestAndExpectQuicResponseFromProxy(const std::string& expected) { |
| 291 SendRequestAndExpectQuicResponseMaybeFromProxy(expected, true); | 291 SendRequestAndExpectQuicResponseMaybeFromProxy(expected, true); |
| 292 } | 292 } |
| 293 | 293 |
| 294 void AddQuicAlternateProtocolMapping( | 294 void AddQuicAlternateProtocolMapping( |
| 295 MockCryptoClientStream::HandshakeMode handshake_mode) { | 295 MockCryptoClientStream::HandshakeMode handshake_mode) { |
| 296 crypto_client_stream_factory_.set_handshake_mode(handshake_mode); | 296 crypto_client_stream_factory_.set_handshake_mode(handshake_mode); |
| 297 session_->http_server_properties()->SetAlternateProtocol( | 297 HostPortPair host_port_pair = HostPortPair::FromURL(request_.url); |
| 298 HostPortPair::FromURL(request_.url), 80, QUIC, 1); | 298 AlternativeService alternative_service(QUIC, host_port_pair.host(), 80); |
| 299 session_->http_server_properties()->SetAlternativeService( |
| 300 host_port_pair, alternative_service, 1.0); |
| 299 } | 301 } |
| 300 | 302 |
| 301 void ExpectBrokenAlternateProtocolMapping() { | 303 void ExpectBrokenAlternateProtocolMapping() { |
| 302 const HostPortPair origin = HostPortPair::FromURL(request_.url); | 304 const HostPortPair origin = HostPortPair::FromURL(request_.url); |
| 303 const AlternativeService alternative_service = | 305 const AlternativeService alternative_service = |
| 304 session_->http_server_properties()->GetAlternativeService(origin); | 306 session_->http_server_properties()->GetAlternativeService(origin); |
| 305 EXPECT_NE(UNINITIALIZED_ALTERNATE_PROTOCOL, alternative_service.protocol); | 307 EXPECT_NE(UNINITIALIZED_ALTERNATE_PROTOCOL, alternative_service.protocol); |
| 306 EXPECT_TRUE(session_->http_server_properties()->IsAlternativeServiceBroken( | 308 EXPECT_TRUE(session_->http_server_properties()->IsAlternativeServiceBroken( |
| 307 alternative_service)); | 309 alternative_service)); |
| 308 } | 310 } |
| (...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1065 nullptr, | 1067 nullptr, |
| 1066 net_log_.bound()); | 1068 net_log_.bound()); |
| 1067 | 1069 |
| 1068 CreateSessionWithNextProtos(); | 1070 CreateSessionWithNextProtos(); |
| 1069 AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT); | 1071 AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT); |
| 1070 SendRequestAndExpectHttpResponse("hello world"); | 1072 SendRequestAndExpectHttpResponse("hello world"); |
| 1071 } | 1073 } |
| 1072 | 1074 |
| 1073 } // namespace test | 1075 } // namespace test |
| 1074 } // namespace net | 1076 } // namespace net |
| OLD | NEW |