| 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_http_stream.h" | 5 #include "net/quic/quic_http_stream.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
| 10 #include "net/base/test_completion_callback.h" | 10 #include "net/base/test_completion_callback.h" |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 451 EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 452 net_log_, callback_.callback())); | 452 net_log_, callback_.callback())); |
| 453 | 453 |
| 454 session_->connection()->CloseConnection(QUIC_NO_ERROR, true); | 454 session_->connection()->CloseConnection(QUIC_NO_ERROR, true); |
| 455 | 455 |
| 456 EXPECT_EQ(ERR_CONNECTION_CLOSED, | 456 EXPECT_EQ(ERR_CONNECTION_CLOSED, |
| 457 stream_->SendRequest(headers_, &response_, | 457 stream_->SendRequest(headers_, &response_, |
| 458 callback_.callback())); | 458 callback_.callback())); |
| 459 } | 459 } |
| 460 | 460 |
| 461 // Regression test for http://crbug.com/409871 |
| 462 TEST_P(QuicHttpStreamTest, SessionClosedBeforeReadResponseHeaders) { |
| 463 SetRequest("GET", "/", DEFAULT_PRIORITY); |
| 464 AddWrite(ConstructRequestHeadersPacket(1, kFin)); |
| 465 Initialize(); |
| 466 |
| 467 request_.method = "GET"; |
| 468 request_.url = GURL("http://www.google.com/"); |
| 469 |
| 470 EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
| 471 net_log_, callback_.callback())); |
| 472 |
| 473 EXPECT_EQ(OK, stream_->SendRequest(headers_, &response_, |
| 474 callback_.callback())); |
| 475 |
| 476 session_->connection()->CloseConnection(QUIC_NO_ERROR, true); |
| 477 |
| 478 EXPECT_NE(OK, stream_->ReadResponseHeaders(callback_.callback())); |
| 479 } |
| 480 |
| 461 TEST_P(QuicHttpStreamTest, SendPostRequest) { | 481 TEST_P(QuicHttpStreamTest, SendPostRequest) { |
| 462 SetRequest("POST", "/", DEFAULT_PRIORITY); | 482 SetRequest("POST", "/", DEFAULT_PRIORITY); |
| 463 AddWrite(ConstructRequestHeadersPacket(1, !kFin)); | 483 AddWrite(ConstructRequestHeadersPacket(1, !kFin)); |
| 464 AddWrite(ConstructDataPacket(2, kIncludeVersion, kFin, 0, kUploadData)); | 484 AddWrite(ConstructDataPacket(2, kIncludeVersion, kFin, 0, kUploadData)); |
| 465 AddWrite(ConstructAckPacket(3, 3, 1)); | 485 AddWrite(ConstructAckPacket(3, 3, 1)); |
| 466 | 486 |
| 467 Initialize(); | 487 Initialize(); |
| 468 | 488 |
| 469 ScopedVector<UploadElementReader> element_readers; | 489 ScopedVector<UploadElementReader> element_readers; |
| 470 element_readers.push_back( | 490 element_readers.push_back( |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 // Set Delegate to NULL and make sure EffectivePriority returns highest | 769 // Set Delegate to NULL and make sure EffectivePriority returns highest |
| 750 // priority. | 770 // priority. |
| 751 reliable_stream->SetDelegate(NULL); | 771 reliable_stream->SetDelegate(NULL); |
| 752 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority, | 772 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority, |
| 753 reliable_stream->EffectivePriority()); | 773 reliable_stream->EffectivePriority()); |
| 754 reliable_stream->SetDelegate(delegate); | 774 reliable_stream->SetDelegate(delegate); |
| 755 } | 775 } |
| 756 | 776 |
| 757 } // namespace test | 777 } // namespace test |
| 758 } // namespace net | 778 } // namespace net |
| OLD | NEW |