OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 14 matching lines...) Expand all Loading... |
25 int InitSession(MockRead* reads, size_t reads_count, | 25 int InitSession(MockRead* reads, size_t reads_count, |
26 MockWrite* writes, size_t writes_count, | 26 MockWrite* writes, size_t writes_count, |
27 HostPortPair& host_port_pair) { | 27 HostPortPair& host_port_pair) { |
28 HostPortProxyPair pair(host_port_pair, ProxyServer::Direct()); | 28 HostPortProxyPair pair(host_port_pair, ProxyServer::Direct()); |
29 data_ = new OrderedSocketData(reads, reads_count, writes, writes_count); | 29 data_ = new OrderedSocketData(reads, reads_count, writes, writes_count); |
30 session_deps_.socket_factory->AddSocketDataProvider(data_.get()); | 30 session_deps_.socket_factory->AddSocketDataProvider(data_.get()); |
31 http_session_ = SpdySessionDependencies::SpdyCreateSession(&session_deps_); | 31 http_session_ = SpdySessionDependencies::SpdyCreateSession(&session_deps_); |
32 session_ = http_session_->spdy_session_pool()->Get(pair, BoundNetLog()); | 32 session_ = http_session_->spdy_session_pool()->Get(pair, BoundNetLog()); |
33 transport_params_ = new TransportSocketParams(host_port_pair, | 33 transport_params_ = new TransportSocketParams(host_port_pair, |
34 MEDIUM, false, false); | 34 MEDIUM, false, false); |
35 TestOldCompletionCallback callback; | 35 TestCompletionCallback callback; |
36 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); | 36 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
37 EXPECT_EQ(ERR_IO_PENDING, | 37 EXPECT_EQ(ERR_IO_PENDING, |
38 connection->Init(host_port_pair.ToString(), | 38 connection->Init(host_port_pair.ToString(), |
39 transport_params_, | 39 transport_params_, |
40 MEDIUM, | 40 MEDIUM, |
41 &callback, | 41 callback.callback(), |
42 http_session_->GetTransportSocketPool(), | 42 http_session_->GetTransportSocketPool(), |
43 BoundNetLog())); | 43 BoundNetLog())); |
44 EXPECT_EQ(OK, callback.WaitForResult()); | 44 EXPECT_EQ(OK, callback.WaitForResult()); |
45 return session_->InitializeWithSocket(connection.release(), false, OK); | 45 return session_->InitializeWithSocket(connection.release(), false, OK); |
46 } | 46 } |
47 SpdySessionDependencies session_deps_; | 47 SpdySessionDependencies session_deps_; |
48 scoped_refptr<OrderedSocketData> data_; | 48 scoped_refptr<OrderedSocketData> data_; |
49 scoped_refptr<HttpNetworkSession> http_session_; | 49 scoped_refptr<HttpNetworkSession> http_session_; |
50 scoped_refptr<SpdySession> session_; | 50 scoped_refptr<SpdySession> session_; |
51 scoped_refptr<TransportSocketParams> transport_params_; | 51 scoped_refptr<TransportSocketParams> transport_params_; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 // pool anymore. | 217 // pool anymore. |
218 EXPECT_FALSE(http_session_->spdy_session_pool()->HasSession(pair)); | 218 EXPECT_FALSE(http_session_->spdy_session_pool()->HasSession(pair)); |
219 EXPECT_TRUE(data()->at_read_eof()); | 219 EXPECT_TRUE(data()->at_read_eof()); |
220 EXPECT_TRUE(data()->at_write_eof()); | 220 EXPECT_TRUE(data()->at_write_eof()); |
221 } | 221 } |
222 | 222 |
223 // TODO(willchan): Write a longer test for SpdyStream that exercises all | 223 // TODO(willchan): Write a longer test for SpdyStream that exercises all |
224 // methods. | 224 // methods. |
225 | 225 |
226 } // namespace net | 226 } // namespace net |
OLD | NEW |