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 "base/memory/ref_counted.h" | 5 #include "base/memory/ref_counted.h" |
6 #include "net/base/completion_callback.h" | 6 #include "net/base/completion_callback.h" |
7 #include "net/base/net_log_unittest.h" | 7 #include "net/base/net_log_unittest.h" |
8 #include "net/spdy/buffered_spdy_framer.h" | 8 #include "net/spdy/buffered_spdy_framer.h" |
9 #include "net/spdy/spdy_stream.h" | 9 #include "net/spdy/spdy_stream.h" |
10 #include "net/spdy/spdy_http_utils.h" | 10 #include "net/spdy/spdy_http_utils.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 EXPECT_TRUE(delegate->closed()); | 239 EXPECT_TRUE(delegate->closed()); |
240 } | 240 } |
241 | 241 |
242 TEST_F(SpdyStreamSpdy2Test, PushedStream) { | 242 TEST_F(SpdyStreamSpdy2Test, PushedStream) { |
243 const char kStreamUrl[] = "http://www.google.com/"; | 243 const char kStreamUrl[] = "http://www.google.com/"; |
244 | 244 |
245 SpdySessionDependencies session_deps; | 245 SpdySessionDependencies session_deps; |
246 session_ = SpdySessionDependencies::SpdyCreateSession(&session_deps); | 246 session_ = SpdySessionDependencies::SpdyCreateSession(&session_deps); |
247 SpdySessionPoolPeer pool_peer_(session_->spdy_session_pool()); | 247 SpdySessionPoolPeer pool_peer_(session_->spdy_session_pool()); |
248 scoped_refptr<SpdySession> spdy_session(CreateSpdySession()); | 248 scoped_refptr<SpdySession> spdy_session(CreateSpdySession()); |
| 249 |
| 250 MockRead reads[] = { |
| 251 MockRead(ASYNC, 0, 0), // EOF |
| 252 }; |
| 253 |
| 254 scoped_ptr<OrderedSocketData> data( |
| 255 new OrderedSocketData(reads, arraysize(reads), NULL, 0)); |
| 256 MockConnect connect_data(SYNCHRONOUS, OK); |
| 257 data->set_connect_data(connect_data); |
| 258 |
| 259 session_deps.socket_factory->AddSocketDataProvider(data.get()); |
| 260 SpdySession::SetSSLMode(false); |
| 261 |
| 262 HostPortPair host_port_pair("www.google.com", 80); |
| 263 scoped_refptr<TransportSocketParams> transport_params( |
| 264 new TransportSocketParams(host_port_pair, LOWEST, false, false)); |
| 265 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
| 266 EXPECT_EQ(OK, connection->Init(host_port_pair.ToString(), transport_params, |
| 267 LOWEST, CompletionCallback(), |
| 268 session_->GetTransportSocketPool(), |
| 269 BoundNetLog())); |
| 270 spdy_session->InitializeWithSocket(connection.release(), false, OK); |
249 BoundNetLog net_log; | 271 BoundNetLog net_log; |
250 | 272 |
251 // Conjure up a stream. | 273 // Conjure up a stream. |
252 scoped_refptr<SpdyStream> stream = new SpdyStream(spdy_session, | 274 scoped_refptr<SpdyStream> stream = new SpdyStream(spdy_session, |
253 2, | 275 2, |
254 true, | 276 true, |
255 net_log); | 277 net_log); |
256 EXPECT_FALSE(stream->response_received()); | 278 EXPECT_FALSE(stream->response_received()); |
257 EXPECT_FALSE(stream->HasUrl()); | 279 EXPECT_FALSE(stream->HasUrl()); |
258 | 280 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 net::NetLog::PHASE_NONE); | 425 net::NetLog::PHASE_NONE); |
404 | 426 |
405 CapturingNetLog::Entry entry = entries[pos]; | 427 CapturingNetLog::Entry entry = entries[pos]; |
406 NetLogSpdyStreamErrorParameter* request_params = | 428 NetLogSpdyStreamErrorParameter* request_params = |
407 static_cast<NetLogSpdyStreamErrorParameter*>( | 429 static_cast<NetLogSpdyStreamErrorParameter*>( |
408 entry.extra_parameters.get()); | 430 entry.extra_parameters.get()); |
409 EXPECT_EQ(stream_id, request_params->stream_id()); | 431 EXPECT_EQ(stream_id, request_params->stream_id()); |
410 } | 432 } |
411 | 433 |
412 } // namespace net | 434 } // namespace net |
OLD | NEW |