| 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_session_peer.h" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 EXPECT_CALL(session_, | 238 EXPECT_CALL(session_, |
| 239 OnStreamHeadersComplete(stream_id, fin, frame->size())); | 239 OnStreamHeadersComplete(stream_id, fin, frame->size())); |
| 240 headers_stream_->ProcessRawData(frame->data(), frame->size()); | 240 headers_stream_->ProcessRawData(frame->data(), frame->size()); |
| 241 | 241 |
| 242 CheckHeaders(); | 242 CheckHeaders(); |
| 243 } | 243 } |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 } | 246 } |
| 247 | 247 |
| 248 TEST_P(QuicHeadersStreamTest, ProcessBadData) { |
| 249 const char kBadData[] = "blah blah blah"; |
| 250 EXPECT_CALL(*connection_, |
| 251 SendConnectionCloseWithDetails( |
| 252 QUIC_INVALID_HEADERS_STREAM_DATA, |
| 253 "SPDY framing error: SPDY_INVALID_DATA_FRAME_FLAGS")); |
| 254 headers_stream_->ProcessRawData(kBadData, strlen(kBadData)); |
| 255 } |
| 256 |
| 248 TEST_P(QuicHeadersStreamTest, ProcessSpdyDataFrame) { | 257 TEST_P(QuicHeadersStreamTest, ProcessSpdyDataFrame) { |
| 249 SpdyDataIR data(2, ""); | 258 SpdyDataIR data(2, ""); |
| 250 scoped_ptr<SpdySerializedFrame> frame(framer_.SerializeFrame(data)); | 259 scoped_ptr<SpdySerializedFrame> frame(framer_.SerializeFrame(data)); |
| 251 EXPECT_CALL(*connection_, | 260 EXPECT_CALL(*connection_, |
| 252 SendConnectionCloseWithDetails(QUIC_INVALID_HEADERS_STREAM_DATA, | 261 SendConnectionCloseWithDetails(QUIC_INVALID_HEADERS_STREAM_DATA, |
| 253 "SPDY DATA frame received.")) | 262 "SPDY DATA frame received.")) |
| 254 .WillOnce(InvokeWithoutArgs(this, | 263 .WillOnce(InvokeWithoutArgs(this, |
| 255 &QuicHeadersStreamTest::CloseConnection)); | 264 &QuicHeadersStreamTest::CloseConnection)); |
| 256 headers_stream_->ProcessRawData(frame->data(), frame->size()); | 265 headers_stream_->ProcessRawData(frame->data(), frame->size()); |
| 257 } | 266 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 } else { | 341 } else { |
| 333 EXPECT_TRUE(headers_stream_->flow_controller()->IsEnabled()); | 342 EXPECT_TRUE(headers_stream_->flow_controller()->IsEnabled()); |
| 334 } | 343 } |
| 335 EXPECT_FALSE(ReliableQuicStreamPeer::StreamContributesToConnectionFlowControl( | 344 EXPECT_FALSE(ReliableQuicStreamPeer::StreamContributesToConnectionFlowControl( |
| 336 headers_stream_)); | 345 headers_stream_)); |
| 337 } | 346 } |
| 338 | 347 |
| 339 } // namespace | 348 } // namespace |
| 340 } // namespace test | 349 } // namespace test |
| 341 } // namespace net | 350 } // namespace net |
| OLD | NEW |