| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "net/spdy/spdy_session.h" | 6 #include "net/spdy/spdy_session.h" |
| 7 #include "net/spdy/spdy_test_util.h" | 7 #include "net/spdy/spdy_test_util.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 HostPortProxyPair pair(host_port_pair, ProxyServer::Direct()); | 61 HostPortProxyPair pair(host_port_pair, ProxyServer::Direct()); |
| 62 EXPECT_EQ(OK, InitSession(reads, arraysize(reads), writes, arraysize(writes), | 62 EXPECT_EQ(OK, InitSession(reads, arraysize(reads), writes, arraysize(writes), |
| 63 host_port_pair)); | 63 host_port_pair)); |
| 64 | 64 |
| 65 HttpRequestInfo request; | 65 HttpRequestInfo request; |
| 66 request.method = "GET"; | 66 request.method = "GET"; |
| 67 request.url = GURL("http://www.google.com/"); | 67 request.url = GURL("http://www.google.com/"); |
| 68 TestCompletionCallback callback; | 68 TestCompletionCallback callback; |
| 69 HttpResponseInfo response; | 69 HttpResponseInfo response; |
| 70 BoundNetLog net_log; | 70 BoundNetLog net_log; |
| 71 scoped_ptr<SpdyHttpStream> http_stream(new SpdyHttpStream(session_.get())); | 71 scoped_ptr<SpdyHttpStream> http_stream( |
| 72 new SpdyHttpStream(session_.get(), true)); |
| 72 ASSERT_EQ( | 73 ASSERT_EQ( |
| 73 OK, | 74 OK, |
| 74 http_stream->InitializeStream(&request, net_log, NULL)); | 75 http_stream->InitializeStream(&request, net_log, NULL)); |
| 75 | 76 |
| 76 EXPECT_EQ(ERR_IO_PENDING, | 77 EXPECT_EQ(ERR_IO_PENDING, |
| 77 http_stream->SendRequest("", NULL, &response, &callback)); | 78 http_stream->SendRequest("", NULL, &response, &callback)); |
| 78 EXPECT_TRUE(http_session_->spdy_session_pool()->HasSession(pair)); | 79 EXPECT_TRUE(http_session_->spdy_session_pool()->HasSession(pair)); |
| 79 | 80 |
| 80 // This triggers the MockWrite and read 2 | 81 // This triggers the MockWrite and read 2 |
| 81 callback.WaitForResult(); | 82 callback.WaitForResult(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 111 HostPortProxyPair pair(host_port_pair, ProxyServer::Direct()); | 112 HostPortProxyPair pair(host_port_pair, ProxyServer::Direct()); |
| 112 EXPECT_EQ(OK, InitSession(reads, arraysize(reads), writes, arraysize(writes), | 113 EXPECT_EQ(OK, InitSession(reads, arraysize(reads), writes, arraysize(writes), |
| 113 host_port_pair)); | 114 host_port_pair)); |
| 114 | 115 |
| 115 HttpRequestInfo request; | 116 HttpRequestInfo request; |
| 116 request.method = "GET"; | 117 request.method = "GET"; |
| 117 request.url = GURL(full_url); | 118 request.url = GURL(full_url); |
| 118 TestCompletionCallback callback; | 119 TestCompletionCallback callback; |
| 119 HttpResponseInfo response; | 120 HttpResponseInfo response; |
| 120 BoundNetLog net_log; | 121 BoundNetLog net_log; |
| 121 scoped_ptr<SpdyHttpStream> http_stream(new SpdyHttpStream(session_)); | 122 scoped_ptr<SpdyHttpStream> http_stream(new SpdyHttpStream(session_, true)); |
| 122 ASSERT_EQ( | 123 ASSERT_EQ( |
| 123 OK, | 124 OK, |
| 124 http_stream->InitializeStream(&request, net_log, NULL)); | 125 http_stream->InitializeStream(&request, net_log, NULL)); |
| 125 | 126 |
| 126 EXPECT_EQ(ERR_IO_PENDING, | 127 EXPECT_EQ(ERR_IO_PENDING, |
| 127 http_stream->SendRequest("", NULL, &response, &callback)); | 128 http_stream->SendRequest("", NULL, &response, &callback)); |
| 128 | 129 |
| 129 spdy::SpdyHeaderBlock* spdy_header = | 130 spdy::SpdyHeaderBlock* spdy_header = |
| 130 http_stream->stream()->spdy_headers().get(); | 131 http_stream->stream()->spdy_headers().get(); |
| 131 EXPECT_TRUE(spdy_header != NULL); | 132 EXPECT_TRUE(spdy_header != NULL); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 144 // pool anymore. | 145 // pool anymore. |
| 145 EXPECT_TRUE(!http_session_->spdy_session_pool()->HasSession(pair)); | 146 EXPECT_TRUE(!http_session_->spdy_session_pool()->HasSession(pair)); |
| 146 EXPECT_TRUE(data()->at_read_eof()); | 147 EXPECT_TRUE(data()->at_read_eof()); |
| 147 EXPECT_TRUE(data()->at_write_eof()); | 148 EXPECT_TRUE(data()->at_write_eof()); |
| 148 } | 149 } |
| 149 | 150 |
| 150 // TODO(willchan): Write a longer test for SpdyStream that exercises all | 151 // TODO(willchan): Write a longer test for SpdyStream that exercises all |
| 151 // methods. | 152 // methods. |
| 152 | 153 |
| 153 } // namespace net | 154 } // namespace net |
| OLD | NEW |