OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_chromium_client_stream.h" | 5 #include "net/quic/quic_chromium_client_stream.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
9 #include "net/base/test_completion_callback.h" | 9 #include "net/base/test_completion_callback.h" |
10 #include "net/quic/quic_chromium_client_session.h" | 10 #include "net/quic/quic_chromium_client_session.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 CreateFunctor(&QuicChromiumClientStreamTest::ReadData, | 243 CreateFunctor(&QuicChromiumClientStreamTest::ReadData, |
244 base::Unretained(this), | 244 base::Unretained(this), |
245 StringPiece(data, arraysize(data) - 1)))); | 245 StringPiece(data, arraysize(data) - 1)))); |
246 base::MessageLoop::current()->RunUntilIdle(); | 246 base::MessageLoop::current()->RunUntilIdle(); |
247 | 247 |
248 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR)); | 248 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR)); |
249 } | 249 } |
250 | 250 |
251 TEST_P(QuicChromiumClientStreamTest, ProcessHeadersWithError) { | 251 TEST_P(QuicChromiumClientStreamTest, ProcessHeadersWithError) { |
252 std::string bad_headers = "..."; | 252 std::string bad_headers = "..."; |
| 253 EXPECT_CALL(session_, |
| 254 SendRstStream(kTestStreamId, QUIC_BAD_APPLICATION_PAYLOAD, 0)); |
| 255 |
253 stream_->OnStreamHeaders(StringPiece(bad_headers)); | 256 stream_->OnStreamHeaders(StringPiece(bad_headers)); |
254 stream_->OnStreamHeadersComplete(false, bad_headers.length()); | 257 stream_->OnStreamHeadersComplete(false, bad_headers.length()); |
255 | 258 |
256 EXPECT_CALL(session_, | |
257 SendRstStream(kTestStreamId, QUIC_BAD_APPLICATION_PAYLOAD, 0)); | |
258 base::MessageLoop::current()->RunUntilIdle(); | 259 base::MessageLoop::current()->RunUntilIdle(); |
259 | 260 |
260 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR)); | 261 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR)); |
261 } | 262 } |
262 | 263 |
263 TEST_P(QuicChromiumClientStreamTest, OnDataAvailableWithError) { | 264 TEST_P(QuicChromiumClientStreamTest, OnDataAvailableWithError) { |
264 InitializeHeaders(); | 265 InitializeHeaders(); |
265 std::string uncompressed_headers = | 266 std::string uncompressed_headers = |
266 SpdyUtils::SerializeUncompressedHeaders(headers_); | 267 SpdyUtils::SerializeUncompressedHeaders(headers_); |
267 stream_->OnStreamHeaders(uncompressed_headers); | 268 stream_->OnStreamHeaders(uncompressed_headers); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 EXPECT_CALL(session_, WritevData(stream_->id(), _, _, _, _, _)) | 326 EXPECT_CALL(session_, WritevData(stream_->id(), _, _, _, _, _)) |
326 .WillOnce(Return(QuicConsumedData(kDataLen, true))); | 327 .WillOnce(Return(QuicConsumedData(kDataLen, true))); |
327 stream_->OnCanWrite(); | 328 stream_->OnCanWrite(); |
328 ASSERT_TRUE(callback.have_result()); | 329 ASSERT_TRUE(callback.have_result()); |
329 EXPECT_EQ(OK, callback.WaitForResult()); | 330 EXPECT_EQ(OK, callback.WaitForResult()); |
330 } | 331 } |
331 | 332 |
332 } // namespace | 333 } // namespace |
333 } // namespace test | 334 } // namespace test |
334 } // namespace net | 335 } // namespace net |
OLD | NEW |