| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/core/quic_headers_stream.h" | 5 #include "net/quic/core/quic_headers_stream.h" |
| 6 | 6 |
| 7 #include <cstdint> | 7 #include <cstdint> |
| 8 #include <ostream> | 8 #include <ostream> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <tuple> | 10 #include <tuple> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "net/quic/core/quic_flags.h" | 13 #include "net/quic/core/quic_flags.h" |
| 14 #include "net/quic/core/quic_utils.h" | 14 #include "net/quic/core/quic_utils.h" |
| 15 #include "net/quic/core/spdy_utils.h" | 15 #include "net/quic/core/spdy_utils.h" |
| 16 #include "net/quic/platform/api/quic_bug_tracker.h" | 16 #include "net/quic/platform/api/quic_bug_tracker.h" |
| 17 #include "net/quic/platform/api/quic_logging.h" | 17 #include "net/quic/platform/api/quic_logging.h" |
| 18 #include "net/quic/platform/api/quic_ptr_util.h" | 18 #include "net/quic/platform/api/quic_ptr_util.h" |
| 19 #include "net/quic/platform/api/quic_str_cat.h" | 19 #include "net/quic/platform/api/quic_str_cat.h" |
| 20 #include "net/quic/platform/api/quic_string_piece.h" |
| 20 #include "net/quic/test_tools/quic_connection_peer.h" | 21 #include "net/quic/test_tools/quic_connection_peer.h" |
| 21 #include "net/quic/test_tools/quic_spdy_session_peer.h" | 22 #include "net/quic/test_tools/quic_spdy_session_peer.h" |
| 22 #include "net/quic/test_tools/quic_stream_peer.h" | 23 #include "net/quic/test_tools/quic_stream_peer.h" |
| 23 #include "net/quic/test_tools/quic_test_utils.h" | 24 #include "net/quic/test_tools/quic_test_utils.h" |
| 24 #include "net/spdy/spdy_alt_svc_wire_format.h" | 25 #include "net/spdy/spdy_alt_svc_wire_format.h" |
| 25 #include "net/spdy/spdy_flags.h" | 26 #include "net/spdy/spdy_flags.h" |
| 26 #include "net/spdy/spdy_protocol.h" | 27 #include "net/spdy/spdy_protocol.h" |
| 27 #include "net/spdy/spdy_test_utils.h" | 28 #include "net/spdy/spdy_test_utils.h" |
| 28 #include "net/test/gtest_util.h" | 29 #include "net/test/gtest_util.h" |
| 29 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
| 30 | 31 |
| 31 using base::StringPiece; | |
| 32 using std::string; | 32 using std::string; |
| 33 using testing::_; | 33 using testing::_; |
| 34 using testing::AtLeast; | 34 using testing::AtLeast; |
| 35 using testing::HasSubstr; | 35 using testing::HasSubstr; |
| 36 using testing::InSequence; | 36 using testing::InSequence; |
| 37 using testing::Invoke; | 37 using testing::Invoke; |
| 38 using testing::Return; | 38 using testing::Return; |
| 39 using testing::StrictMock; | 39 using testing::StrictMock; |
| 40 using testing::WithArgs; | 40 using testing::WithArgs; |
| 41 | 41 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 MOCK_METHOD2(OnWindowUpdate, | 94 MOCK_METHOD2(OnWindowUpdate, |
| 95 void(SpdyStreamId stream_id, int delta_window_size)); | 95 void(SpdyStreamId stream_id, int delta_window_size)); |
| 96 MOCK_METHOD1(OnBlocked, void(SpdyStreamId stream_id)); | 96 MOCK_METHOD1(OnBlocked, void(SpdyStreamId stream_id)); |
| 97 MOCK_METHOD3(OnPushPromise, | 97 MOCK_METHOD3(OnPushPromise, |
| 98 void(SpdyStreamId stream_id, | 98 void(SpdyStreamId stream_id, |
| 99 SpdyStreamId promised_stream_id, | 99 SpdyStreamId promised_stream_id, |
| 100 bool end)); | 100 bool end)); |
| 101 MOCK_METHOD2(OnContinuation, void(SpdyStreamId stream_id, bool end)); | 101 MOCK_METHOD2(OnContinuation, void(SpdyStreamId stream_id, bool end)); |
| 102 MOCK_METHOD3(OnAltSvc, | 102 MOCK_METHOD3(OnAltSvc, |
| 103 void(SpdyStreamId stream_id, | 103 void(SpdyStreamId stream_id, |
| 104 StringPiece origin, | 104 QuicStringPiece origin, |
| 105 const SpdyAltSvcWireFormat::AlternativeServiceVector& | 105 const SpdyAltSvcWireFormat::AlternativeServiceVector& |
| 106 altsvc_vector)); | 106 altsvc_vector)); |
| 107 MOCK_METHOD4(OnPriority, | 107 MOCK_METHOD4(OnPriority, |
| 108 void(SpdyStreamId stream_id, | 108 void(SpdyStreamId stream_id, |
| 109 SpdyStreamId parent_stream_id, | 109 SpdyStreamId parent_stream_id, |
| 110 int weight, | 110 int weight, |
| 111 bool exclusive)); | 111 bool exclusive)); |
| 112 MOCK_METHOD2(OnUnknownFrame, | 112 MOCK_METHOD2(OnUnknownFrame, |
| 113 bool(SpdyStreamId stream_id, uint8_t frame_type)); | 113 bool(SpdyStreamId stream_id, uint8_t frame_type)); |
| 114 }; | 114 }; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 | 275 |
| 276 void SavePayload(const char* data, size_t len) { | 276 void SavePayload(const char* data, size_t len) { |
| 277 saved_payloads_.append(data, len); | 277 saved_payloads_.append(data, len); |
| 278 } | 278 } |
| 279 | 279 |
| 280 bool SaveHeaderData(const char* data, int len) { | 280 bool SaveHeaderData(const char* data, int len) { |
| 281 saved_header_data_.append(data, len); | 281 saved_header_data_.append(data, len); |
| 282 return true; | 282 return true; |
| 283 } | 283 } |
| 284 | 284 |
| 285 void SaveHeaderDataStringPiece(StringPiece data) { | 285 void SaveHeaderDataStringPiece(QuicStringPiece data) { |
| 286 saved_header_data_.append(data.data(), data.length()); | 286 saved_header_data_.append(data.data(), data.length()); |
| 287 } | 287 } |
| 288 | 288 |
| 289 void SavePromiseHeaderList(QuicStreamId /* stream_id */, | 289 void SavePromiseHeaderList(QuicStreamId /* stream_id */, |
| 290 QuicStreamId /* promised_stream_id */, | 290 QuicStreamId /* promised_stream_id */, |
| 291 size_t size, | 291 size_t size, |
| 292 const QuicHeaderList& header_list) { | 292 const QuicHeaderList& header_list) { |
| 293 SaveToHandler(size, header_list); | 293 SaveToHandler(size, header_list); |
| 294 } | 294 } |
| 295 | 295 |
| (...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 consumed_data = session_.WritevStreamData(id, MakeIOVector(data, &iov), | 1041 consumed_data = session_.WritevStreamData(id, MakeIOVector(data, &iov), |
| 1042 offset, fin, nullptr); | 1042 offset, fin, nullptr); |
| 1043 | 1043 |
| 1044 EXPECT_EQ(consumed_data.bytes_consumed, 0u); | 1044 EXPECT_EQ(consumed_data.bytes_consumed, 0u); |
| 1045 EXPECT_EQ(consumed_data.fin_consumed, false); | 1045 EXPECT_EQ(consumed_data.fin_consumed, false); |
| 1046 } | 1046 } |
| 1047 | 1047 |
| 1048 } // namespace | 1048 } // namespace |
| 1049 } // namespace test | 1049 } // namespace test |
| 1050 } // namespace net | 1050 } // namespace net |
| OLD | NEW |