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 "base/ref_counted.h" | 6 #include "base/ref_counted.h" |
7 #include "base/time.h" | 7 #include "base/time.h" |
8 #include "net/base/mock_host_resolver.h" | 8 #include "net/base/mock_host_resolver.h" |
9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
10 #include "net/base/net_log.h" | 10 #include "net/base/net_log.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 }; | 108 }; |
109 | 109 |
110 // Needs fixing, see http://crbug.com/28622 | 110 // Needs fixing, see http://crbug.com/28622 |
111 TEST_F(SpdyHttpStreamTest, SendRequest) { | 111 TEST_F(SpdyHttpStreamTest, SendRequest) { |
112 scoped_refptr<SpdySession> session(CreateSpdySession()); | 112 scoped_refptr<SpdySession> session(CreateSpdySession()); |
113 HttpRequestInfo request; | 113 HttpRequestInfo request; |
114 request.method = "GET"; | 114 request.method = "GET"; |
115 request.url = GURL("http://www.google.com/"); | 115 request.url = GURL("http://www.google.com/"); |
116 TestCompletionCallback callback; | 116 TestCompletionCallback callback; |
117 HttpResponseInfo response; | 117 HttpResponseInfo response; |
118 | 118 scoped_ptr<SpdyHttpStream> http_stream(new SpdyHttpStream()); |
119 scoped_refptr<SpdyStream> stream; | |
120 ASSERT_EQ( | 119 ASSERT_EQ( |
121 OK, | 120 OK, |
122 session->CreateStream(request.url, HIGHEST, &stream, BoundNetLog())); | 121 http_stream->InitializeStream(session, request, BoundNetLog(), NULL)); |
123 | 122 http_stream->InitializeRequest(base::Time::Now(), NULL); |
124 scoped_ptr<SpdyHttpStream> http_stream(new SpdyHttpStream(stream.get())); | |
125 http_stream->InitializeRequest(request, base::Time::Now(), NULL); | |
126 EXPECT_EQ(ERR_IO_PENDING, | 123 EXPECT_EQ(ERR_IO_PENDING, |
127 http_stream->SendRequest(&response, &callback)); | 124 http_stream->SendRequest(&response, &callback)); |
128 | 125 |
129 // Need to manually remove the spdy session since normally it gets removed on | 126 // Need to manually remove the spdy session since normally it gets removed on |
130 // socket close/error, but we aren't communicating over a socket here. | 127 // socket close/error, but we aren't communicating over a socket here. |
131 pool_peer_.RemoveSpdySession(session); | 128 pool_peer_.RemoveSpdySession(session); |
132 } | 129 } |
133 | 130 |
134 // TODO(willchan): Write a longer test for SpdyStream that exercises all | 131 // TODO(willchan): Write a longer test for SpdyStream that exercises all |
135 // methods. | 132 // methods. |
136 | 133 |
137 } // namespace | 134 } // namespace |
138 | 135 |
139 } // namespace net | 136 } // namespace net |
OLD | NEW |