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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 session_->http_server_properties()->SetAlternateProtocol( |
298 HostPortPair::FromURL(request_.url), 80, QUIC, 1); | 298 HostPortPair::FromURL(request_.url), 80, QUIC, 1); |
299 } | 299 } |
300 | 300 |
301 void ExpectBrokenAlternateProtocolMapping() { | 301 void ExpectBrokenAlternateProtocolMapping() { |
| 302 const HostPortPair origin = HostPortPair::FromURL(request_.url); |
302 const AlternateProtocolInfo alternate = | 303 const AlternateProtocolInfo alternate = |
303 session_->http_server_properties()->GetAlternateProtocol( | 304 session_->http_server_properties()->GetAlternateProtocol(origin); |
304 HostPortPair::FromURL(request_.url)); | |
305 EXPECT_NE(UNINITIALIZED_ALTERNATE_PROTOCOL, alternate.protocol); | 305 EXPECT_NE(UNINITIALIZED_ALTERNATE_PROTOCOL, alternate.protocol); |
306 EXPECT_TRUE(alternate.is_broken); | 306 const AlternativeService alternative_service(alternate.protocol, |
| 307 origin.host(), alternate.port); |
| 308 EXPECT_TRUE(session_->http_server_properties()->IsAlternativeServiceBroken( |
| 309 alternative_service)); |
307 } | 310 } |
308 | 311 |
309 void ExpectQuicAlternateProtocolMapping() { | 312 void ExpectQuicAlternateProtocolMapping() { |
310 const AlternateProtocolInfo alternate = | 313 const AlternateProtocolInfo alternate = |
311 session_->http_server_properties()->GetAlternateProtocol( | 314 session_->http_server_properties()->GetAlternateProtocol( |
312 HostPortPair::FromURL(request_.url)); | 315 HostPortPair::FromURL(request_.url)); |
313 EXPECT_EQ(QUIC, alternate.protocol); | 316 EXPECT_EQ(QUIC, alternate.protocol); |
314 } | 317 } |
315 | 318 |
316 void AddHangingNonAlternateProtocolSocketData() { | 319 void AddHangingNonAlternateProtocolSocketData() { |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 nullptr, | 1067 nullptr, |
1065 net_log_.bound()); | 1068 net_log_.bound()); |
1066 | 1069 |
1067 CreateSessionWithNextProtos(); | 1070 CreateSessionWithNextProtos(); |
1068 AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT); | 1071 AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT); |
1069 SendRequestAndExpectHttpResponse("hello world"); | 1072 SendRequestAndExpectHttpResponse("hello world"); |
1070 } | 1073 } |
1071 | 1074 |
1072 } // namespace test | 1075 } // namespace test |
1073 } // namespace net | 1076 } // namespace net |
OLD | NEW |