OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/tools/quic/quic_spdy_server_stream.h" | 5 #include "net/tools/quic/quic_spdy_server_stream.h" |
6 | 6 |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "base/strings/string_piece.h" | 8 #include "base/strings/string_piece.h" |
9 #include "net/quic/quic_connection.h" | 9 #include "net/quic/quic_connection.h" |
10 #include "net/quic/quic_flags.h" | 10 #include "net/quic/quic_flags.h" |
11 #include "net/quic/quic_protocol.h" | 11 #include "net/quic/quic_protocol.h" |
12 #include "net/quic/quic_utils.h" | 12 #include "net/quic/quic_utils.h" |
13 #include "net/quic/spdy_utils.h" | 13 #include "net/quic/spdy_utils.h" |
14 #include "net/quic/test_tools/quic_test_utils.h" | 14 #include "net/quic/test_tools/quic_test_utils.h" |
15 #include "net/quic/test_tools/reliable_quic_stream_peer.h" | 15 #include "net/quic/test_tools/reliable_quic_stream_peer.h" |
16 #include "net/tools/epoll_server/epoll_server.h" | 16 #include "net/tools/epoll_server/epoll_server.h" |
17 #include "net/tools/quic/quic_in_memory_cache.h" | 17 #include "net/tools/quic/quic_in_memory_cache.h" |
18 #include "net/tools/quic/spdy_balsa_utils.h" | 18 #include "net/tools/quic/spdy_balsa_utils.h" |
19 #include "net/tools/quic/test_tools/quic_in_memory_cache_peer.h" | 19 #include "net/tools/quic/test_tools/quic_in_memory_cache_peer.h" |
20 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
22 | 22 |
23 using base::StringPiece; | 23 using base::StringPiece; |
24 using net::test::MockConnection; | 24 using net::test::MockConnection; |
25 using net::test::MockHelper; | 25 using net::test::MockConnectionHelper; |
26 using net::test::MockQuicSpdySession; | 26 using net::test::MockQuicSpdySession; |
27 using net::test::ReliableQuicStreamPeer; | 27 using net::test::ReliableQuicStreamPeer; |
28 using net::test::SupportedVersions; | 28 using net::test::SupportedVersions; |
29 using net::test::kInitialSessionFlowControlWindowForTest; | 29 using net::test::kInitialSessionFlowControlWindowForTest; |
30 using net::test::kInitialStreamFlowControlWindowForTest; | 30 using net::test::kInitialStreamFlowControlWindowForTest; |
31 using std::string; | 31 using std::string; |
32 using testing::_; | 32 using testing::_; |
33 using testing::AnyNumber; | 33 using testing::AnyNumber; |
34 using testing::Invoke; | 34 using testing::Invoke; |
35 using testing::InvokeArgument; | 35 using testing::InvokeArgument; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 QuicInMemoryCachePeer::ResetForTests(); | 119 QuicInMemoryCachePeer::ResetForTests(); |
120 } | 120 } |
121 | 121 |
122 const string& StreamBody() { return QuicSpdyServerStreamPeer::body(stream_); } | 122 const string& StreamBody() { return QuicSpdyServerStreamPeer::body(stream_); } |
123 | 123 |
124 StringPiece StreamHeadersValue(const string& key) { | 124 StringPiece StreamHeadersValue(const string& key) { |
125 return (*stream_->mutable_headers())[key]; | 125 return (*stream_->mutable_headers())[key]; |
126 } | 126 } |
127 | 127 |
128 SpdyHeaderBlock response_headers_; | 128 SpdyHeaderBlock response_headers_; |
129 MockHelper helper_; | 129 MockConnectionHelper helper_; |
130 StrictMock<MockConnection>* connection_; | 130 StrictMock<MockConnection>* connection_; |
131 StrictMock<MockQuicSpdySession> session_; | 131 StrictMock<MockQuicSpdySession> session_; |
132 QuicSpdyServerStreamPeer* stream_; // Owned by session_. | 132 QuicSpdyServerStreamPeer* stream_; // Owned by session_. |
133 string headers_string_; | 133 string headers_string_; |
134 string body_; | 134 string body_; |
135 }; | 135 }; |
136 | 136 |
137 QuicConsumedData ConsumeAllData( | 137 QuicConsumedData ConsumeAllData( |
138 QuicStreamId /*id*/, | 138 QuicStreamId /*id*/, |
139 const QuicIOVector& data, | 139 const QuicIOVector& data, |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 StringPiece data(arr, arraysize(arr)); | 326 StringPiece data(arr, arraysize(arr)); |
327 QuicStreamFrame frame(stream_->id(), true, 0, data); | 327 QuicStreamFrame frame(stream_->id(), true, 0, data); |
328 // Verify that we don't crash when we get a invalid headers in stream frame. | 328 // Verify that we don't crash when we get a invalid headers in stream frame. |
329 stream_->OnStreamFrame(frame); | 329 stream_->OnStreamFrame(frame); |
330 } | 330 } |
331 | 331 |
332 } // namespace | 332 } // namespace |
333 } // namespace test | 333 } // namespace test |
334 } // namespace tools | 334 } // namespace tools |
335 } // namespace net | 335 } // namespace net |
OLD | NEW |