| 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/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 2428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2439 base::MessageLoop::current()->RunUntilIdle(); // Write as much as we can. | 2439 base::MessageLoop::current()->RunUntilIdle(); // Write as much as we can. |
| 2440 | 2440 |
| 2441 SpdyHttpStream* stream = static_cast<SpdyHttpStream*>(trans->stream_.get()); | 2441 SpdyHttpStream* stream = static_cast<SpdyHttpStream*>(trans->stream_.get()); |
| 2442 ASSERT_TRUE(stream != NULL); | 2442 ASSERT_TRUE(stream != NULL); |
| 2443 ASSERT_TRUE(stream->stream() != NULL); | 2443 ASSERT_TRUE(stream->stream() != NULL); |
| 2444 EXPECT_EQ(0, stream->stream()->send_window_size()); | 2444 EXPECT_EQ(0, stream->stream()->send_window_size()); |
| 2445 // All the body data should have been read. | 2445 // All the body data should have been read. |
| 2446 // TODO(satorux): This is because of the weirdness in reading the request | 2446 // TODO(satorux): This is because of the weirdness in reading the request |
| 2447 // body in OnSendBodyComplete(). See crbug.com/113107. | 2447 // body in OnSendBodyComplete(). See crbug.com/113107. |
| 2448 EXPECT_TRUE(upload_data_stream.IsEOF()); | 2448 EXPECT_TRUE(upload_data_stream.IsEOF()); |
| 2449 // But the body is not yet fully sent (kUploadData is not yet sent). | 2449 // But the body is not yet fully sent (kUploadData is not yet sent) |
| 2450 EXPECT_FALSE(stream->stream()->body_sent()); | 2450 // since we're send-stalled. |
| 2451 EXPECT_TRUE(stream->stream()->send_stalled_by_flow_control()); |
| 2451 | 2452 |
| 2452 data.ForceNextRead(); // Read in WINDOW_UPDATE frame. | 2453 data.ForceNextRead(); // Read in WINDOW_UPDATE frame. |
| 2453 rv = callback.WaitForResult(); | 2454 rv = callback.WaitForResult(); |
| 2454 helper.VerifyDataConsumed(); | 2455 helper.VerifyDataConsumed(); |
| 2455 } | 2456 } |
| 2456 | 2457 |
| 2457 // Test we correctly handle the case where the SETTINGS frame results in | 2458 // Test we correctly handle the case where the SETTINGS frame results in |
| 2458 // unstalling the send window. | 2459 // unstalling the send window. |
| 2459 TEST_P(SpdyNetworkTransactionSpdy3Test, FlowControlStallResumeAfterSettings) { | 2460 TEST_P(SpdyNetworkTransactionSpdy3Test, FlowControlStallResumeAfterSettings) { |
| 2460 // Number of frames we need to send to zero out the window size: data | 2461 // Number of frames we need to send to zero out the window size: data |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2541 | 2542 |
| 2542 SpdyHttpStream* stream = static_cast<SpdyHttpStream*>(trans->stream_.get()); | 2543 SpdyHttpStream* stream = static_cast<SpdyHttpStream*>(trans->stream_.get()); |
| 2543 ASSERT_TRUE(stream != NULL); | 2544 ASSERT_TRUE(stream != NULL); |
| 2544 ASSERT_TRUE(stream->stream() != NULL); | 2545 ASSERT_TRUE(stream->stream() != NULL); |
| 2545 EXPECT_EQ(0, stream->stream()->send_window_size()); | 2546 EXPECT_EQ(0, stream->stream()->send_window_size()); |
| 2546 | 2547 |
| 2547 // All the body data should have been read. | 2548 // All the body data should have been read. |
| 2548 // TODO(satorux): This is because of the weirdness in reading the request | 2549 // TODO(satorux): This is because of the weirdness in reading the request |
| 2549 // body in OnSendBodyComplete(). See crbug.com/113107. | 2550 // body in OnSendBodyComplete(). See crbug.com/113107. |
| 2550 EXPECT_TRUE(upload_data_stream.IsEOF()); | 2551 EXPECT_TRUE(upload_data_stream.IsEOF()); |
| 2551 // But the body is not yet fully sent (kUploadData is not yet sent). | 2552 // But the body is not yet fully sent (kUploadData is not yet sent) |
| 2552 EXPECT_FALSE(stream->stream()->body_sent()); | 2553 // since we're send-stalled. |
| 2553 EXPECT_TRUE(stream->stream()->send_stalled_by_flow_control()); | 2554 EXPECT_TRUE(stream->stream()->send_stalled_by_flow_control()); |
| 2554 | 2555 |
| 2555 data.ForceNextRead(); // Read in SETTINGS frame to unstall. | 2556 data.ForceNextRead(); // Read in SETTINGS frame to unstall. |
| 2556 rv = callback.WaitForResult(); | 2557 rv = callback.WaitForResult(); |
| 2557 helper.VerifyDataConsumed(); | 2558 helper.VerifyDataConsumed(); |
| 2558 // If stream is NULL, that means it was unstalled and closed. | 2559 // If stream is NULL, that means it was unstalled and closed. |
| 2559 EXPECT_TRUE(stream->stream() == NULL); | 2560 EXPECT_TRUE(stream->stream() == NULL); |
| 2560 } | 2561 } |
| 2561 | 2562 |
| 2562 // Test we correctly handle the case where the SETTINGS frame results in a | 2563 // Test we correctly handle the case where the SETTINGS frame results in a |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2651 | 2652 |
| 2652 SpdyHttpStream* stream = static_cast<SpdyHttpStream*>(trans->stream_.get()); | 2653 SpdyHttpStream* stream = static_cast<SpdyHttpStream*>(trans->stream_.get()); |
| 2653 ASSERT_TRUE(stream != NULL); | 2654 ASSERT_TRUE(stream != NULL); |
| 2654 ASSERT_TRUE(stream->stream() != NULL); | 2655 ASSERT_TRUE(stream->stream() != NULL); |
| 2655 EXPECT_EQ(0, stream->stream()->send_window_size()); | 2656 EXPECT_EQ(0, stream->stream()->send_window_size()); |
| 2656 | 2657 |
| 2657 // All the body data should have been read. | 2658 // All the body data should have been read. |
| 2658 // TODO(satorux): This is because of the weirdness in reading the request | 2659 // TODO(satorux): This is because of the weirdness in reading the request |
| 2659 // body in OnSendBodyComplete(). See crbug.com/113107. | 2660 // body in OnSendBodyComplete(). See crbug.com/113107. |
| 2660 EXPECT_TRUE(upload_data_stream.IsEOF()); | 2661 EXPECT_TRUE(upload_data_stream.IsEOF()); |
| 2661 // But the body is not yet fully sent (kUploadData is not yet sent). | 2662 // But the body is not yet fully sent (kUploadData is not yet sent) |
| 2662 EXPECT_FALSE(stream->stream()->body_sent()); | 2663 // since we're send-stalled. |
| 2664 EXPECT_TRUE(stream->stream()->send_stalled_by_flow_control()); |
| 2663 | 2665 |
| 2664 data.ForceNextRead(); // Read in WINDOW_UPDATE or SETTINGS frame. | 2666 data.ForceNextRead(); // Read in WINDOW_UPDATE or SETTINGS frame. |
| 2665 rv = callback.WaitForResult(); | 2667 rv = callback.WaitForResult(); |
| 2666 helper.VerifyDataConsumed(); | 2668 helper.VerifyDataConsumed(); |
| 2667 } | 2669 } |
| 2668 | 2670 |
| 2669 TEST_P(SpdyNetworkTransactionSpdy3Test, ResetReplyWithTransferEncoding) { | 2671 TEST_P(SpdyNetworkTransactionSpdy3Test, ResetReplyWithTransferEncoding) { |
| 2670 // Construct the request. | 2672 // Construct the request. |
| 2671 scoped_ptr<SpdyFrame> req( | 2673 scoped_ptr<SpdyFrame> req( |
| 2672 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); | 2674 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); |
| (...skipping 3857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6530 // And now we can allow everything else to run to completion. | 6532 // And now we can allow everything else to run to completion. |
| 6531 data.SetStop(10); | 6533 data.SetStop(10); |
| 6532 data.Run(); | 6534 data.Run(); |
| 6533 EXPECT_EQ(OK, callback2.WaitForResult()); | 6535 EXPECT_EQ(OK, callback2.WaitForResult()); |
| 6534 EXPECT_EQ(OK, callback3.WaitForResult()); | 6536 EXPECT_EQ(OK, callback3.WaitForResult()); |
| 6535 | 6537 |
| 6536 helper.VerifyDataConsumed(); | 6538 helper.VerifyDataConsumed(); |
| 6537 } | 6539 } |
| 6538 | 6540 |
| 6539 } // namespace net | 6541 } // namespace net |
| OLD | NEW |