| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/bidirectional_stream.h" | 5 #include "net/http/bidirectional_stream.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> |
| 8 | 9 |
| 9 #include "base/macros.h" | 10 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 11 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 12 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/string_piece.h" | 14 #include "base/strings/string_piece.h" |
| 14 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 15 #include "base/timer/mock_timer.h" | 16 #include "base/timer/mock_timer.h" |
| 16 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
| 17 #include "net/http/bidirectional_stream_request_info.h" | 18 #include "net/http/bidirectional_stream_request_info.h" |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 std::unique_ptr<SpdySerializedFrame> resp( | 517 std::unique_ptr<SpdySerializedFrame> resp( |
| 517 spdy_util_.ConstructSpdyGetSynReply(nullptr, 0, 1)); | 518 spdy_util_.ConstructSpdyGetSynReply(nullptr, 0, 1)); |
| 518 std::unique_ptr<SpdySerializedFrame> response_body_frame1( | 519 std::unique_ptr<SpdySerializedFrame> response_body_frame1( |
| 519 spdy_util_.ConstructSpdyBodyFrame(1, false)); | 520 spdy_util_.ConstructSpdyBodyFrame(1, false)); |
| 520 std::unique_ptr<SpdySerializedFrame> response_body_frame2( | 521 std::unique_ptr<SpdySerializedFrame> response_body_frame2( |
| 521 spdy_util_.ConstructSpdyBodyFrame(1, false)); | 522 spdy_util_.ConstructSpdyBodyFrame(1, false)); |
| 522 | 523 |
| 523 SpdyHeaderBlock trailers; | 524 SpdyHeaderBlock trailers; |
| 524 trailers["foo"] = "bar"; | 525 trailers["foo"] = "bar"; |
| 525 std::unique_ptr<SpdySerializedFrame> response_trailers( | 526 std::unique_ptr<SpdySerializedFrame> response_trailers( |
| 526 spdy_util_.ConstructSpdyResponseHeaders(1, trailers, true)); | 527 spdy_util_.ConstructSpdyResponseHeaders(1, std::move(trailers), true)); |
| 527 | 528 |
| 528 MockRead reads[] = { | 529 MockRead reads[] = { |
| 529 CreateMockRead(*resp, 1), | 530 CreateMockRead(*resp, 1), |
| 530 MockRead(ASYNC, ERR_IO_PENDING, 2), // Force a pause. | 531 MockRead(ASYNC, ERR_IO_PENDING, 2), // Force a pause. |
| 531 CreateMockRead(*response_body_frame1, 4), | 532 CreateMockRead(*response_body_frame1, 4), |
| 532 MockRead(ASYNC, ERR_IO_PENDING, 5), // Force a pause. | 533 MockRead(ASYNC, ERR_IO_PENDING, 5), // Force a pause. |
| 533 CreateMockRead(*response_body_frame2, 6), | 534 CreateMockRead(*response_body_frame2, 6), |
| 534 CreateMockRead(*response_trailers, 7), | 535 CreateMockRead(*response_trailers, 7), |
| 535 MockRead(ASYNC, 0, 8), | 536 MockRead(ASYNC, 0, 8), |
| 536 }; | 537 }; |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1006 | 1007 |
| 1007 std::unique_ptr<SpdySerializedFrame> resp( | 1008 std::unique_ptr<SpdySerializedFrame> resp( |
| 1008 spdy_util_.ConstructSpdyGetSynReply(kExtraResponseHeaders, 1, 1)); | 1009 spdy_util_.ConstructSpdyGetSynReply(kExtraResponseHeaders, 1, 1)); |
| 1009 | 1010 |
| 1010 std::unique_ptr<SpdySerializedFrame> body_frame( | 1011 std::unique_ptr<SpdySerializedFrame> body_frame( |
| 1011 spdy_util_.ConstructSpdyBodyFrame(1, false)); | 1012 spdy_util_.ConstructSpdyBodyFrame(1, false)); |
| 1012 | 1013 |
| 1013 SpdyHeaderBlock trailers; | 1014 SpdyHeaderBlock trailers; |
| 1014 trailers["foo"] = "bar"; | 1015 trailers["foo"] = "bar"; |
| 1015 std::unique_ptr<SpdySerializedFrame> response_trailers( | 1016 std::unique_ptr<SpdySerializedFrame> response_trailers( |
| 1016 spdy_util_.ConstructSpdyResponseHeaders(1, trailers, true)); | 1017 spdy_util_.ConstructSpdyResponseHeaders(1, std::move(trailers), true)); |
| 1017 | 1018 |
| 1018 MockRead reads[] = { | 1019 MockRead reads[] = { |
| 1019 CreateMockRead(*resp, 1), | 1020 CreateMockRead(*resp, 1), |
| 1020 CreateMockRead(*body_frame, 2), | 1021 CreateMockRead(*body_frame, 2), |
| 1021 CreateMockRead(*body_frame, 3), | 1022 CreateMockRead(*body_frame, 3), |
| 1022 CreateMockRead(*body_frame, 4), | 1023 CreateMockRead(*body_frame, 4), |
| 1023 MockRead(ASYNC, ERR_IO_PENDING, 5), // Force a pause. | 1024 MockRead(ASYNC, ERR_IO_PENDING, 5), // Force a pause. |
| 1024 CreateMockRead(*response_trailers, 6), | 1025 CreateMockRead(*response_trailers, 6), |
| 1025 MockRead(SYNCHRONOUS, 0, 7), | 1026 MockRead(SYNCHRONOUS, 0, 7), |
| 1026 }; | 1027 }; |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1411 | 1412 |
| 1412 std::unique_ptr<SpdySerializedFrame> resp( | 1413 std::unique_ptr<SpdySerializedFrame> resp( |
| 1413 spdy_util_.ConstructSpdyGetSynReply(kExtraResponseHeaders, 1, 1)); | 1414 spdy_util_.ConstructSpdyGetSynReply(kExtraResponseHeaders, 1, 1)); |
| 1414 | 1415 |
| 1415 std::unique_ptr<SpdySerializedFrame> response_body_frame( | 1416 std::unique_ptr<SpdySerializedFrame> response_body_frame( |
| 1416 spdy_util_.ConstructSpdyBodyFrame(1, false)); | 1417 spdy_util_.ConstructSpdyBodyFrame(1, false)); |
| 1417 | 1418 |
| 1418 SpdyHeaderBlock trailers; | 1419 SpdyHeaderBlock trailers; |
| 1419 trailers["foo"] = "bar"; | 1420 trailers["foo"] = "bar"; |
| 1420 std::unique_ptr<SpdySerializedFrame> response_trailers( | 1421 std::unique_ptr<SpdySerializedFrame> response_trailers( |
| 1421 spdy_util_.ConstructSpdyResponseHeaders(1, trailers, true)); | 1422 spdy_util_.ConstructSpdyResponseHeaders(1, std::move(trailers), true)); |
| 1422 | 1423 |
| 1423 MockRead reads[] = { | 1424 MockRead reads[] = { |
| 1424 CreateMockRead(*resp, 1), CreateMockRead(*response_body_frame, 2), | 1425 CreateMockRead(*resp, 1), CreateMockRead(*response_body_frame, 2), |
| 1425 CreateMockRead(*response_trailers, 3), MockRead(ASYNC, 0, 5), | 1426 CreateMockRead(*response_trailers, 3), MockRead(ASYNC, 0, 5), |
| 1426 }; | 1427 }; |
| 1427 | 1428 |
| 1428 HostPortPair host_port_pair("www.example.org", 443); | 1429 HostPortPair host_port_pair("www.example.org", 443); |
| 1429 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), | 1430 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), |
| 1430 PRIVACY_MODE_DISABLED); | 1431 PRIVACY_MODE_DISABLED); |
| 1431 InitSession(reads, arraysize(reads), writes, arraysize(writes), key); | 1432 InitSession(reads, arraysize(reads), writes, arraysize(writes), key); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1578 AlternativeServiceVector alternative_service_vector = | 1579 AlternativeServiceVector alternative_service_vector = |
| 1579 http_session_->http_server_properties()->GetAlternativeServices(server); | 1580 http_session_->http_server_properties()->GetAlternativeServices(server); |
| 1580 ASSERT_EQ(1u, alternative_service_vector.size()); | 1581 ASSERT_EQ(1u, alternative_service_vector.size()); |
| 1581 EXPECT_EQ(AlternateProtocolFromNextProto(kProtoQUIC1SPDY3), | 1582 EXPECT_EQ(AlternateProtocolFromNextProto(kProtoQUIC1SPDY3), |
| 1582 alternative_service_vector[0].protocol); | 1583 alternative_service_vector[0].protocol); |
| 1583 EXPECT_EQ("www.example.org", alternative_service_vector[0].host); | 1584 EXPECT_EQ("www.example.org", alternative_service_vector[0].host); |
| 1584 EXPECT_EQ(443, alternative_service_vector[0].port); | 1585 EXPECT_EQ(443, alternative_service_vector[0].port); |
| 1585 } | 1586 } |
| 1586 | 1587 |
| 1587 } // namespace net | 1588 } // namespace net |
| OLD | NEW |