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/spdy/spdy_http_stream.h" | 5 #include "net/spdy/spdy_http_stream.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 scoped_refptr<HttpNetworkSession> http_session_; | 123 scoped_refptr<HttpNetworkSession> http_session_; |
124 base::WeakPtr<SpdySession> session_; | 124 base::WeakPtr<SpdySession> session_; |
125 | 125 |
126 private: | 126 private: |
127 MockECSignatureCreatorFactory ec_signature_creator_factory_; | 127 MockECSignatureCreatorFactory ec_signature_creator_factory_; |
128 }; | 128 }; |
129 | 129 |
130 INSTANTIATE_TEST_CASE_P( | 130 INSTANTIATE_TEST_CASE_P( |
131 NextProto, | 131 NextProto, |
132 SpdyHttpStreamTest, | 132 SpdyHttpStreamTest, |
133 testing::Values(kProtoDeprecatedSPDY2, | 133 testing::Values(kProtoSPDY31, kProtoSPDY4_14, kProtoSPDY4_15)); |
134 kProtoSPDY3, kProtoSPDY31, kProtoSPDY4_14, kProtoSPDY4_15)); | |
135 | 134 |
136 // SpdyHttpStream::GetUploadProgress() should still work even before the | 135 // SpdyHttpStream::GetUploadProgress() should still work even before the |
137 // stream is initialized. | 136 // stream is initialized. |
138 TEST_P(SpdyHttpStreamTest, GetUploadProgressBeforeInitialization) { | 137 TEST_P(SpdyHttpStreamTest, GetUploadProgressBeforeInitialization) { |
139 MockRead reads[] = { | 138 MockRead reads[] = { |
140 MockRead(ASYNC, 0, 0) // EOF | 139 MockRead(ASYNC, 0, 0) // EOF |
141 }; | 140 }; |
142 | 141 |
143 HostPortPair host_port_pair("www.google.com", 80); | 142 HostPortPair host_port_pair("www.google.com", 80); |
144 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), | 143 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 EXPECT_FALSE(HasSpdySession(http_session_->spdy_session_pool(), key)); | 692 EXPECT_FALSE(HasSpdySession(http_session_->spdy_session_pool(), key)); |
694 EXPECT_TRUE(data()->at_read_eof()); | 693 EXPECT_TRUE(data()->at_read_eof()); |
695 EXPECT_TRUE(data()->at_write_eof()); | 694 EXPECT_TRUE(data()->at_write_eof()); |
696 } | 695 } |
697 | 696 |
698 // The tests below are only for SPDY/3 and above. | 697 // The tests below are only for SPDY/3 and above. |
699 | 698 |
700 // Test the receipt of a WINDOW_UPDATE frame while waiting for a chunk to be | 699 // Test the receipt of a WINDOW_UPDATE frame while waiting for a chunk to be |
701 // made available is handled correctly. | 700 // made available is handled correctly. |
702 TEST_P(SpdyHttpStreamTest, DelayedSendChunkedPostWithWindowUpdate) { | 701 TEST_P(SpdyHttpStreamTest, DelayedSendChunkedPostWithWindowUpdate) { |
703 if (GetParam() < kProtoSPDY3) | |
704 return; | |
705 | |
706 scoped_ptr<SpdyFrame> req(spdy_util_.ConstructChunkedSpdyPost(NULL, 0)); | 702 scoped_ptr<SpdyFrame> req(spdy_util_.ConstructChunkedSpdyPost(NULL, 0)); |
707 scoped_ptr<SpdyFrame> chunk1(spdy_util_.ConstructSpdyBodyFrame(1, true)); | 703 scoped_ptr<SpdyFrame> chunk1(spdy_util_.ConstructSpdyBodyFrame(1, true)); |
708 MockWrite writes[] = { | 704 MockWrite writes[] = { |
709 CreateMockWrite(*req.get(), 0), | 705 CreateMockWrite(*req.get(), 0), |
710 CreateMockWrite(*chunk1, 1), | 706 CreateMockWrite(*chunk1, 1), |
711 }; | 707 }; |
712 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyPostSynReply(NULL, 0)); | 708 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyPostSynReply(NULL, 0)); |
713 scoped_ptr<SpdyFrame> window_update( | 709 scoped_ptr<SpdyFrame> window_update( |
714 spdy_util_.ConstructSpdyWindowUpdate(1, kUploadDataSize)); | 710 spdy_util_.ConstructSpdyWindowUpdate(1, kUploadDataSize)); |
715 MockRead reads[] = { | 711 MockRead reads[] = { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 ASSERT_TRUE(response.headers.get()); | 782 ASSERT_TRUE(response.headers.get()); |
787 ASSERT_EQ(200, response.headers->response_code()); | 783 ASSERT_EQ(200, response.headers->response_code()); |
788 EXPECT_TRUE(deterministic_data_->at_read_eof()); | 784 EXPECT_TRUE(deterministic_data_->at_read_eof()); |
789 EXPECT_TRUE(deterministic_data_->at_write_eof()); | 785 EXPECT_TRUE(deterministic_data_->at_write_eof()); |
790 } | 786 } |
791 | 787 |
792 // TODO(willchan): Write a longer test for SpdyStream that exercises all | 788 // TODO(willchan): Write a longer test for SpdyStream that exercises all |
793 // methods. | 789 // methods. |
794 | 790 |
795 } // namespace net | 791 } // namespace net |
OLD | NEW |