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/quic_data_stream.h" | 5 #include "net/quic/quic_data_stream.h" |
6 | 6 |
7 #include "net/quic/quic_ack_notifier.h" | 7 #include "net/quic/quic_ack_notifier.h" |
8 #include "net/quic/quic_connection.h" | 8 #include "net/quic/quic_connection.h" |
9 #include "net/quic/quic_utils.h" | 9 #include "net/quic/quic_utils.h" |
10 #include "net/quic/quic_write_blocked_list.h" | 10 #include "net/quic/quic_write_blocked_list.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 namespace net { | 29 namespace net { |
30 namespace test { | 30 namespace test { |
31 namespace { | 31 namespace { |
32 | 32 |
33 const bool kShouldProcessData = true; | 33 const bool kShouldProcessData = true; |
34 | 34 |
35 class TestStream : public QuicDataStream { | 35 class TestStream : public QuicDataStream { |
36 public: | 36 public: |
37 TestStream(QuicStreamId id, | 37 TestStream(QuicStreamId id, |
38 QuicSession* session, | 38 QuicSpdySession* session, |
39 bool should_process_data) | 39 bool should_process_data) |
40 : QuicDataStream(id, session), | 40 : QuicDataStream(id, session), |
41 should_process_data_(should_process_data) {} | 41 should_process_data_(should_process_data) {} |
42 | 42 |
43 uint32 ProcessData(const char* data, uint32 data_len) override { | 43 uint32 ProcessData(const char* data, uint32 data_len) override { |
44 EXPECT_NE(0u, data_len); | 44 EXPECT_NE(0u, data_len); |
45 DVLOG(1) << "ProcessData data_len: " << data_len; | 45 DVLOG(1) << "ProcessData data_len: " << data_len; |
46 data_ += string(data, data_len); | 46 data_ += string(data, data_len); |
47 return should_process_data_ ? data_len : 0; | 47 return should_process_data_ ? data_len : 0; |
48 } | 48 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 "QnyXHeGeK2UINUzJ-D30AFcpqYgH9_1BvYSpi7fc7_ydBU8TaD8ZRxvtnzXqj0RfG" | 86 "QnyXHeGeK2UINUzJ-D30AFcpqYgH9_1BvYSpi7fc7_ydBU8TaD8ZRxvtnzXqj0RfG" |
87 "tuHghmv3aD-uzSYJ75XDdzKdizZ86IG6Fbn1XFhYZM-fbHhm3mVEXnyRW4ZuNOLFk" | 87 "tuHghmv3aD-uzSYJ75XDdzKdizZ86IG6Fbn1XFhYZM-fbHhm3mVEXnyRW4ZuNOLFk" |
88 "Fas6LMcVC6Q8QLlHYbXBpdNFuGbuZGUnav5C-2I_-46lL0NGg3GewxGKGHvHEfoyn" | 88 "Fas6LMcVC6Q8QLlHYbXBpdNFuGbuZGUnav5C-2I_-46lL0NGg3GewxGKGHvHEfoyn" |
89 "EFFlEYHsBQ98rXImL8ySDycdLEFvBPdtctPmWCfTxwmoSMLHU2SCVDhbqMWU5b0yr" | 89 "EFFlEYHsBQ98rXImL8ySDycdLEFvBPdtctPmWCfTxwmoSMLHU2SCVDhbqMWU5b0yr" |
90 "JBCScs_ejbKaqBDoB7ZGxTvqlrB__2ZmnHHjCr8RgMRtKNtIeuZAo "; | 90 "JBCScs_ejbKaqBDoB7ZGxTvqlrB__2ZmnHHjCr8RgMRtKNtIeuZAo "; |
91 } | 91 } |
92 | 92 |
93 void Initialize(bool stream_should_process_data) { | 93 void Initialize(bool stream_should_process_data) { |
94 connection_ = new testing::StrictMock<MockConnection>( | 94 connection_ = new testing::StrictMock<MockConnection>( |
95 Perspective::IS_SERVER, SupportedVersions(GetParam())); | 95 Perspective::IS_SERVER, SupportedVersions(GetParam())); |
96 session_.reset(new testing::StrictMock<MockSession>(connection_)); | 96 session_.reset(new testing::StrictMock<MockQuicSpdySession>(connection_)); |
97 stream_.reset(new TestStream(kClientDataStreamId1, session_.get(), | 97 stream_.reset(new TestStream(kClientDataStreamId1, session_.get(), |
98 stream_should_process_data)); | 98 stream_should_process_data)); |
99 stream2_.reset(new TestStream(kClientDataStreamId2, session_.get(), | 99 stream2_.reset(new TestStream(kClientDataStreamId2, session_.get(), |
100 stream_should_process_data)); | 100 stream_should_process_data)); |
101 write_blocked_list_ = | 101 write_blocked_list_ = |
102 QuicSessionPeer::GetWriteBlockedStreams(session_.get()); | 102 QuicSessionPeer::GetWriteBlockedStreams(session_.get()); |
103 } | 103 } |
104 | 104 |
105 protected: | 105 protected: |
106 MockConnection* connection_; | 106 MockConnection* connection_; |
107 scoped_ptr<MockSession> session_; | 107 scoped_ptr<MockQuicSpdySession> session_; |
108 scoped_ptr<TestStream> stream_; | 108 scoped_ptr<TestStream> stream_; |
109 scoped_ptr<TestStream> stream2_; | 109 scoped_ptr<TestStream> stream2_; |
110 SpdyHeaderBlock headers_; | 110 SpdyHeaderBlock headers_; |
111 QuicWriteBlockedList* write_blocked_list_; | 111 QuicWriteBlockedList* write_blocked_list_; |
112 }; | 112 }; |
113 | 113 |
114 INSTANTIATE_TEST_CASE_P(Tests, QuicDataStreamTest, | 114 INSTANTIATE_TEST_CASE_P(Tests, QuicDataStreamTest, |
115 ::testing::ValuesIn(QuicSupportedVersions())); | 115 ::testing::ValuesIn(QuicSupportedVersions())); |
116 | 116 |
117 TEST_P(QuicDataStreamTest, ProcessHeaders) { | 117 TEST_P(QuicDataStreamTest, ProcessHeaders) { |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 EXPECT_CALL(*connection_, SendBlocked(kClientDataStreamId1)).Times(0); | 541 EXPECT_CALL(*connection_, SendBlocked(kClientDataStreamId1)).Times(0); |
542 EXPECT_CALL(*session_, WritevData(kClientDataStreamId1, _, _, _, _, _)) | 542 EXPECT_CALL(*session_, WritevData(kClientDataStreamId1, _, _, _, _, _)) |
543 .WillOnce(Return(QuicConsumedData(0, fin))); | 543 .WillOnce(Return(QuicConsumedData(0, fin))); |
544 | 544 |
545 stream_->WriteOrBufferData(body, fin, nullptr); | 545 stream_->WriteOrBufferData(body, fin, nullptr); |
546 } | 546 } |
547 | 547 |
548 } // namespace | 548 } // namespace |
549 } // namespace test | 549 } // namespace test |
550 } // namespace net | 550 } // namespace net |
OLD | NEW |