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