| 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_headers_stream.h" | 5 #include "net/quic/quic_headers_stream.h" |
| 6 | 6 |
| 7 #include "net/quic/quic_utils.h" | 7 #include "net/quic/quic_utils.h" |
| 8 #include "net/quic/spdy_utils.h" | 8 #include "net/quic/spdy_utils.h" |
| 9 #include "net/quic/test_tools/quic_connection_peer.h" | 9 #include "net/quic/test_tools/quic_connection_peer.h" |
| 10 #include "net/quic/test_tools/quic_session_peer.h" | 10 #include "net/quic/test_tools/quic_spdy_session_peer.h" |
| 11 #include "net/quic/test_tools/quic_test_utils.h" | 11 #include "net/quic/test_tools/quic_test_utils.h" |
| 12 #include "net/quic/test_tools/reliable_quic_stream_peer.h" | 12 #include "net/quic/test_tools/reliable_quic_stream_peer.h" |
| 13 #include "net/spdy/spdy_protocol.h" | 13 #include "net/spdy/spdy_protocol.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 using base::StringPiece; | 16 using base::StringPiece; |
| 17 using std::ostream; | 17 using std::ostream; |
| 18 using std::string; | 18 using std::string; |
| 19 using std::vector; | 19 using std::vector; |
| 20 using testing::Invoke; | 20 using testing::Invoke; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 } | 98 } |
| 99 return params; | 99 return params; |
| 100 } | 100 } |
| 101 | 101 |
| 102 class QuicHeadersStreamTest : public ::testing::TestWithParam<TestParams> { | 102 class QuicHeadersStreamTest : public ::testing::TestWithParam<TestParams> { |
| 103 public: | 103 public: |
| 104 QuicHeadersStreamTest() | 104 QuicHeadersStreamTest() |
| 105 : connection_( | 105 : connection_( |
| 106 new StrictMock<MockConnection>(perspective(), GetVersion())), | 106 new StrictMock<MockConnection>(perspective(), GetVersion())), |
| 107 session_(connection_), | 107 session_(connection_), |
| 108 headers_stream_(QuicSessionPeer::GetHeadersStream(&session_)), | 108 headers_stream_(QuicSpdySessionPeer::GetHeadersStream(&session_)), |
| 109 body_("hello world"), | 109 body_("hello world"), |
| 110 framer_(SPDY4) { | 110 framer_(SPDY4) { |
| 111 headers_[":version"] = "HTTP/1.1"; | 111 headers_[":version"] = "HTTP/1.1"; |
| 112 headers_[":status"] = "200 Ok"; | 112 headers_[":status"] = "200 Ok"; |
| 113 headers_["content-length"] = "11"; | 113 headers_["content-length"] = "11"; |
| 114 framer_.set_visitor(&visitor_); | 114 framer_.set_visitor(&visitor_); |
| 115 EXPECT_EQ(version(), session_.connection()->version()); | 115 EXPECT_EQ(version(), session_.connection()->version()); |
| 116 EXPECT_TRUE(headers_stream_ != nullptr); | 116 EXPECT_TRUE(headers_stream_ != nullptr); |
| 117 VLOG(1) << GetParam(); | 117 VLOG(1) << GetParam(); |
| 118 } | 118 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 198 } |
| 199 | 199 |
| 200 void CloseConnection() { | 200 void CloseConnection() { |
| 201 QuicConnectionPeer::CloseConnection(connection_); | 201 QuicConnectionPeer::CloseConnection(connection_); |
| 202 } | 202 } |
| 203 | 203 |
| 204 static const bool kFrameComplete = true; | 204 static const bool kFrameComplete = true; |
| 205 static const bool kHasPriority = true; | 205 static const bool kHasPriority = true; |
| 206 | 206 |
| 207 StrictMock<MockConnection>* connection_; | 207 StrictMock<MockConnection>* connection_; |
| 208 StrictMock<MockSession> session_; | 208 StrictMock<MockQuicSpdySession> session_; |
| 209 QuicHeadersStream* headers_stream_; | 209 QuicHeadersStream* headers_stream_; |
| 210 SpdyHeaderBlock headers_; | 210 SpdyHeaderBlock headers_; |
| 211 string body_; | 211 string body_; |
| 212 string saved_data_; | 212 string saved_data_; |
| 213 string saved_header_data_; | 213 string saved_header_data_; |
| 214 SpdyFramer framer_; | 214 SpdyFramer framer_; |
| 215 StrictMock<MockVisitor> visitor_; | 215 StrictMock<MockVisitor> visitor_; |
| 216 }; | 216 }; |
| 217 | 217 |
| 218 INSTANTIATE_TEST_CASE_P(Tests, | 218 INSTANTIATE_TEST_CASE_P(Tests, |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 } | 396 } |
| 397 | 397 |
| 398 TEST_P(QuicHeadersStreamTest, NoConnectionLevelFlowControl) { | 398 TEST_P(QuicHeadersStreamTest, NoConnectionLevelFlowControl) { |
| 399 EXPECT_FALSE(ReliableQuicStreamPeer::StreamContributesToConnectionFlowControl( | 399 EXPECT_FALSE(ReliableQuicStreamPeer::StreamContributesToConnectionFlowControl( |
| 400 headers_stream_)); | 400 headers_stream_)); |
| 401 } | 401 } |
| 402 | 402 |
| 403 } // namespace | 403 } // namespace |
| 404 } // namespace test | 404 } // namespace test |
| 405 } // namespace net | 405 } // namespace net |
| OLD | NEW |