| 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_spdy_session_peer.h" | 10 #include "net/quic/test_tools/quic_spdy_session_peer.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 params.push_back(TestParams(version, Perspective::IS_CLIENT)); | 116 params.push_back(TestParams(version, Perspective::IS_CLIENT)); |
| 117 params.push_back(TestParams(version, Perspective::IS_SERVER)); | 117 params.push_back(TestParams(version, Perspective::IS_SERVER)); |
| 118 } | 118 } |
| 119 FLAGS_quic_supports_push_promise = true; | 119 FLAGS_quic_supports_push_promise = true; |
| 120 return params; | 120 return params; |
| 121 } | 121 } |
| 122 | 122 |
| 123 class QuicHeadersStreamTest : public ::testing::TestWithParam<TestParams> { | 123 class QuicHeadersStreamTest : public ::testing::TestWithParam<TestParams> { |
| 124 public: | 124 public: |
| 125 QuicHeadersStreamTest() | 125 QuicHeadersStreamTest() |
| 126 : connection_(new StrictMock<MockConnection>(&helper_, | 126 : connection_(new StrictMock<MockQuicConnection>(&helper_, |
| 127 &alarm_factory_, | 127 &alarm_factory_, |
| 128 perspective(), | 128 perspective(), |
| 129 GetVersion())), | 129 GetVersion())), |
| 130 session_(connection_), | 130 session_(connection_), |
| 131 headers_stream_(QuicSpdySessionPeer::GetHeadersStream(&session_)), | 131 headers_stream_(QuicSpdySessionPeer::GetHeadersStream(&session_)), |
| 132 body_("hello world"), | 132 body_("hello world"), |
| 133 stream_frame_(kHeadersStreamId, /*fin=*/false, /*offset=*/0, ""), | 133 stream_frame_(kHeadersStreamId, /*fin=*/false, /*offset=*/0, ""), |
| 134 next_promised_stream_id_(2) { | 134 next_promised_stream_id_(2) { |
| 135 FLAGS_quic_always_log_bugs_for_tests = true; | 135 FLAGS_quic_always_log_bugs_for_tests = true; |
| 136 headers_[":version"] = "HTTP/1.1"; | 136 headers_[":version"] = "HTTP/1.1"; |
| 137 headers_[":status"] = "200 Ok"; | 137 headers_[":status"] = "200 Ok"; |
| 138 headers_["content-length"] = "11"; | 138 headers_["content-length"] = "11"; |
| 139 framer_ = std::unique_ptr<SpdyFramer>(new SpdyFramer(HTTP2)); | 139 framer_ = std::unique_ptr<SpdyFramer>(new SpdyFramer(HTTP2)); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 228 |
| 229 void TearDownLocalConnectionState() { | 229 void TearDownLocalConnectionState() { |
| 230 QuicConnectionPeer::TearDownLocalConnectionState(connection_); | 230 QuicConnectionPeer::TearDownLocalConnectionState(connection_); |
| 231 } | 231 } |
| 232 | 232 |
| 233 QuicStreamId NextPromisedStreamId() { return next_promised_stream_id_ += 2; } | 233 QuicStreamId NextPromisedStreamId() { return next_promised_stream_id_ += 2; } |
| 234 | 234 |
| 235 static const bool kFrameComplete = true; | 235 static const bool kFrameComplete = true; |
| 236 static const bool kHasPriority = true; | 236 static const bool kHasPriority = true; |
| 237 | 237 |
| 238 MockConnectionHelper helper_; | 238 MockQuicConnectionHelper helper_; |
| 239 MockAlarmFactory alarm_factory_; | 239 MockAlarmFactory alarm_factory_; |
| 240 StrictMock<MockConnection>* connection_; | 240 StrictMock<MockQuicConnection>* connection_; |
| 241 StrictMock<MockQuicSpdySession> session_; | 241 StrictMock<MockQuicSpdySession> session_; |
| 242 QuicHeadersStream* headers_stream_; | 242 QuicHeadersStream* headers_stream_; |
| 243 SpdyHeaderBlock headers_; | 243 SpdyHeaderBlock headers_; |
| 244 string body_; | 244 string body_; |
| 245 string saved_data_; | 245 string saved_data_; |
| 246 string saved_header_data_; | 246 string saved_header_data_; |
| 247 std::unique_ptr<SpdyFramer> framer_; | 247 std::unique_ptr<SpdyFramer> framer_; |
| 248 StrictMock<MockVisitor> visitor_; | 248 StrictMock<MockVisitor> visitor_; |
| 249 QuicStreamFrame stream_frame_; | 249 QuicStreamFrame stream_frame_; |
| 250 QuicStreamId next_promised_stream_id_; | 250 QuicStreamId next_promised_stream_id_; |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 } | 583 } |
| 584 | 584 |
| 585 TEST_P(QuicHeadersStreamTest, NoConnectionLevelFlowControl) { | 585 TEST_P(QuicHeadersStreamTest, NoConnectionLevelFlowControl) { |
| 586 EXPECT_FALSE(ReliableQuicStreamPeer::StreamContributesToConnectionFlowControl( | 586 EXPECT_FALSE(ReliableQuicStreamPeer::StreamContributesToConnectionFlowControl( |
| 587 headers_stream_)); | 587 headers_stream_)); |
| 588 } | 588 } |
| 589 | 589 |
| 590 } // namespace | 590 } // namespace |
| 591 } // namespace test | 591 } // namespace test |
| 592 } // namespace net | 592 } // namespace net |
| OLD | NEW |