| 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 "net/quic/chromium/quic_http_stream.h" | 5 #include "net/quic/chromium/quic_http_stream.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
| 16 #include "net/base/chunked_upload_data_stream.h" | 16 #include "net/base/chunked_upload_data_stream.h" |
| 17 #include "net/base/elements_upload_data_stream.h" | 17 #include "net/base/elements_upload_data_stream.h" |
| 18 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
| 19 #include "net/base/test_completion_callback.h" | 19 #include "net/base/test_completion_callback.h" |
| 20 #include "net/base/upload_bytes_element_reader.h" | 20 #include "net/base/upload_bytes_element_reader.h" |
| 21 #include "net/http/http_response_headers.h" | 21 #include "net/http/http_response_headers.h" |
| 22 #include "net/http/transport_security_state.h" | 22 #include "net/http/transport_security_state.h" |
| 23 #include "net/log/net_log_event_type.h" |
| 23 #include "net/log/test_net_log.h" | 24 #include "net/log/test_net_log.h" |
| 24 #include "net/log/test_net_log_util.h" | 25 #include "net/log/test_net_log_util.h" |
| 25 #include "net/quic/chromium/crypto/proof_verifier_chromium.h" | 26 #include "net/quic/chromium/crypto/proof_verifier_chromium.h" |
| 26 #include "net/quic/chromium/quic_chromium_alarm_factory.h" | 27 #include "net/quic/chromium/quic_chromium_alarm_factory.h" |
| 27 #include "net/quic/chromium/quic_chromium_connection_helper.h" | 28 #include "net/quic/chromium/quic_chromium_connection_helper.h" |
| 28 #include "net/quic/chromium/quic_chromium_packet_reader.h" | 29 #include "net/quic/chromium/quic_chromium_packet_reader.h" |
| 29 #include "net/quic/chromium/quic_chromium_packet_writer.h" | 30 #include "net/quic/chromium/quic_chromium_packet_writer.h" |
| 30 #include "net/quic/core/congestion_control/send_algorithm_interface.h" | 31 #include "net/quic/core/congestion_control/send_algorithm_interface.h" |
| 31 #include "net/quic/core/crypto/crypto_protocol.h" | 32 #include "net/quic/core/crypto/crypto_protocol.h" |
| 32 #include "net/quic/core/crypto/quic_decrypter.h" | 33 #include "net/quic/core/crypto/quic_decrypter.h" |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 stream_->GetTotalSentBytes()); | 721 stream_->GetTotalSentBytes()); |
| 721 EXPECT_EQ( | 722 EXPECT_EQ( |
| 722 static_cast<int64_t>(spdy_response_header_frame_length + | 723 static_cast<int64_t>(spdy_response_header_frame_length + |
| 723 strlen(kResponseBody) + +spdy_trailers_frame_length), | 724 strlen(kResponseBody) + +spdy_trailers_frame_length), |
| 724 stream_->GetTotalReceivedBytes()); | 725 stream_->GetTotalReceivedBytes()); |
| 725 // Check that NetLog was filled as expected. | 726 // Check that NetLog was filled as expected. |
| 726 TestNetLogEntry::List entries; | 727 TestNetLogEntry::List entries; |
| 727 net_log_.GetEntries(&entries); | 728 net_log_.GetEntries(&entries); |
| 728 size_t pos = ExpectLogContainsSomewhere( | 729 size_t pos = ExpectLogContainsSomewhere( |
| 729 entries, /*min_offset=*/0, | 730 entries, /*min_offset=*/0, |
| 730 NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS, | 731 NetLogEventType::QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS, |
| 731 NetLog::PHASE_NONE); | 732 NetLogEventPhase::NONE); |
| 732 pos = ExpectLogContainsSomewhere( | 733 pos = ExpectLogContainsSomewhere( |
| 733 entries, /*min_offset=*/pos, | 734 entries, /*min_offset=*/pos, |
| 734 NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS, | 735 NetLogEventType::QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS, |
| 735 NetLog::PHASE_NONE); | 736 NetLogEventPhase::NONE); |
| 736 ExpectLogContainsSomewhere( | 737 ExpectLogContainsSomewhere( |
| 737 entries, /*min_offset=*/pos, | 738 entries, /*min_offset=*/pos, |
| 738 NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS, | 739 NetLogEventType::QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS, |
| 739 NetLog::PHASE_NONE); | 740 NetLogEventPhase::NONE); |
| 740 } | 741 } |
| 741 | 742 |
| 742 // Regression test for http://crbug.com/288128 | 743 // Regression test for http://crbug.com/288128 |
| 743 TEST_P(QuicHttpStreamTest, GetRequestLargeResponse) { | 744 TEST_P(QuicHttpStreamTest, GetRequestLargeResponse) { |
| 744 SetRequest("GET", "/", DEFAULT_PRIORITY); | 745 SetRequest("GET", "/", DEFAULT_PRIORITY); |
| 745 size_t spdy_request_headers_frame_length; | 746 size_t spdy_request_headers_frame_length; |
| 746 AddWrite(ConstructRequestHeadersPacket(1, kFin, DEFAULT_PRIORITY, | 747 AddWrite(ConstructRequestHeadersPacket(1, kFin, DEFAULT_PRIORITY, |
| 747 &spdy_request_headers_frame_length)); | 748 &spdy_request_headers_frame_length)); |
| 748 Initialize(); | 749 Initialize(); |
| 749 | 750 |
| (...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1952 EXPECT_TRUE(AtEof()); | 1953 EXPECT_TRUE(AtEof()); |
| 1953 | 1954 |
| 1954 // QuicHttpStream::GetTotalSent/ReceivedBytes includes only headers. | 1955 // QuicHttpStream::GetTotalSent/ReceivedBytes includes only headers. |
| 1955 EXPECT_EQ(static_cast<int64_t>(spdy_request_headers_frame_length), | 1956 EXPECT_EQ(static_cast<int64_t>(spdy_request_headers_frame_length), |
| 1956 stream_->GetTotalSentBytes()); | 1957 stream_->GetTotalSentBytes()); |
| 1957 EXPECT_EQ(0, stream_->GetTotalReceivedBytes()); | 1958 EXPECT_EQ(0, stream_->GetTotalReceivedBytes()); |
| 1958 } | 1959 } |
| 1959 | 1960 |
| 1960 } // namespace test | 1961 } // namespace test |
| 1961 } // namespace net | 1962 } // namespace net |
| OLD | NEW |