OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/bidirectional_stream_quic_impl.h" | 5 #include "net/quic/chromium/bidirectional_stream_quic_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "net/base/ip_address.h" | 13 #include "net/base/ip_address.h" |
14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
15 #include "net/http/bidirectional_stream_request_info.h" | 15 #include "net/http/bidirectional_stream_request_info.h" |
16 #include "net/http/transport_security_state.h" | 16 #include "net/http/transport_security_state.h" |
| 17 #include "net/log/net_log_event_type.h" |
17 #include "net/log/test_net_log.h" | 18 #include "net/log/test_net_log.h" |
18 #include "net/log/test_net_log_util.h" | 19 #include "net/log/test_net_log_util.h" |
19 #include "net/quic/chromium/quic_chromium_alarm_factory.h" | 20 #include "net/quic/chromium/quic_chromium_alarm_factory.h" |
20 #include "net/quic/chromium/quic_chromium_connection_helper.h" | 21 #include "net/quic/chromium/quic_chromium_connection_helper.h" |
21 #include "net/quic/chromium/quic_chromium_packet_reader.h" | 22 #include "net/quic/chromium/quic_chromium_packet_reader.h" |
22 #include "net/quic/chromium/quic_chromium_packet_writer.h" | 23 #include "net/quic/chromium/quic_chromium_packet_writer.h" |
23 #include "net/quic/core/crypto/crypto_protocol.h" | 24 #include "net/quic/core/crypto/crypto_protocol.h" |
24 #include "net/quic/core/crypto/quic_decrypter.h" | 25 #include "net/quic/core/crypto/quic_decrypter.h" |
25 #include "net/quic/core/crypto/quic_encrypter.h" | 26 #include "net/quic/core/crypto/quic_encrypter.h" |
26 #include "net/quic/core/crypto/quic_server_info.h" | 27 #include "net/quic/core/crypto/quic_server_info.h" |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 delegate->GetTotalSentBytes()); | 699 delegate->GetTotalSentBytes()); |
699 EXPECT_EQ( | 700 EXPECT_EQ( |
700 static_cast<int64_t>(spdy_response_headers_frame_length + | 701 static_cast<int64_t>(spdy_response_headers_frame_length + |
701 strlen(kResponseBody) + spdy_trailers_frame_length), | 702 strlen(kResponseBody) + spdy_trailers_frame_length), |
702 delegate->GetTotalReceivedBytes()); | 703 delegate->GetTotalReceivedBytes()); |
703 // Check that NetLog was filled as expected. | 704 // Check that NetLog was filled as expected. |
704 TestNetLogEntry::List entries; | 705 TestNetLogEntry::List entries; |
705 net_log().GetEntries(&entries); | 706 net_log().GetEntries(&entries); |
706 size_t pos = ExpectLogContainsSomewhere( | 707 size_t pos = ExpectLogContainsSomewhere( |
707 entries, /*min_offset=*/0, | 708 entries, /*min_offset=*/0, |
708 NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS, | 709 NetLogEventType::QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS, |
709 NetLog::PHASE_NONE); | 710 NetLogEventPhase::NONE); |
710 pos = ExpectLogContainsSomewhere( | 711 pos = ExpectLogContainsSomewhere( |
711 entries, /*min_offset=*/pos, | 712 entries, /*min_offset=*/pos, |
712 NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS, | 713 NetLogEventType::QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS, |
713 NetLog::PHASE_NONE); | 714 NetLogEventPhase::NONE); |
714 ExpectLogContainsSomewhere( | 715 ExpectLogContainsSomewhere( |
715 entries, /*min_offset=*/pos, | 716 entries, /*min_offset=*/pos, |
716 NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS, | 717 NetLogEventType::QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS, |
717 NetLog::PHASE_NONE); | 718 NetLogEventPhase::NONE); |
718 } | 719 } |
719 | 720 |
720 // Tests that when request headers are not delayed, only data buffers are | 721 // Tests that when request headers are not delayed, only data buffers are |
721 // coalesced. | 722 // coalesced. |
722 TEST_P(BidirectionalStreamQuicImplTest, CoalesceDataBuffersNotHeadersFrame) { | 723 TEST_P(BidirectionalStreamQuicImplTest, CoalesceDataBuffersNotHeadersFrame) { |
723 SetRequest("POST", "/", DEFAULT_PRIORITY); | 724 SetRequest("POST", "/", DEFAULT_PRIORITY); |
724 size_t spdy_request_headers_frame_length; | 725 size_t spdy_request_headers_frame_length; |
725 | 726 |
726 const char kBody1[] = "here are some data"; | 727 const char kBody1[] = "here are some data"; |
727 const char kBody2[] = "data keep coming"; | 728 const char kBody2[] = "data keep coming"; |
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1628 | 1629 |
1629 base::RunLoop().RunUntilIdle(); | 1630 base::RunLoop().RunUntilIdle(); |
1630 | 1631 |
1631 EXPECT_EQ(1, delegate->on_data_read_count()); | 1632 EXPECT_EQ(1, delegate->on_data_read_count()); |
1632 EXPECT_EQ(0, delegate->on_data_sent_count()); | 1633 EXPECT_EQ(0, delegate->on_data_sent_count()); |
1633 } | 1634 } |
1634 | 1635 |
1635 } // namespace test | 1636 } // namespace test |
1636 | 1637 |
1637 } // namespace net | 1638 } // namespace net |
OLD | NEW |