| 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_proxy_client_socket.h" | 5 #include "net/spdy/spdy_proxy_client_socket.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "net/base/address_list.h" | 10 #include "net/base/address_list.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 } | 103 } |
| 104 | 104 |
| 105 void Run(int steps) { | 105 void Run(int steps) { |
| 106 data_->StopAfter(steps); | 106 data_->StopAfter(steps); |
| 107 data_->Run(); | 107 data_->Run(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 scoped_ptr<SpdyProxyClientSocket> sock_; | 110 scoped_ptr<SpdyProxyClientSocket> sock_; |
| 111 TestCompletionCallback read_callback_; | 111 TestCompletionCallback read_callback_; |
| 112 TestCompletionCallback write_callback_; | 112 TestCompletionCallback write_callback_; |
| 113 scoped_refptr<DeterministicSocketData> data_; | 113 scoped_ptr<DeterministicSocketData> data_; |
| 114 | 114 |
| 115 private: | 115 private: |
| 116 scoped_refptr<HttpNetworkSession> session_; | 116 scoped_refptr<HttpNetworkSession> session_; |
| 117 scoped_refptr<IOBuffer> read_buf_; | 117 scoped_refptr<IOBuffer> read_buf_; |
| 118 SpdySessionDependencies session_deps_; | 118 SpdySessionDependencies session_deps_; |
| 119 MockConnect connect_data_; | 119 MockConnect connect_data_; |
| 120 scoped_refptr<SpdySession> spdy_session_; | 120 scoped_refptr<SpdySession> spdy_session_; |
| 121 scoped_refptr<SpdyStream> spdy_stream_; | 121 scoped_refptr<SpdyStream> spdy_stream_; |
| 122 BufferedSpdyFramer framer_; | 122 BufferedSpdyFramer framer_; |
| 123 | 123 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 163 |
| 164 // Empty the current queue. | 164 // Empty the current queue. |
| 165 MessageLoop::current()->RunAllPending(); | 165 MessageLoop::current()->RunAllPending(); |
| 166 PlatformTest::TearDown(); | 166 PlatformTest::TearDown(); |
| 167 } | 167 } |
| 168 | 168 |
| 169 void SpdyProxyClientSocketSpdy3Test::Initialize(MockRead* reads, | 169 void SpdyProxyClientSocketSpdy3Test::Initialize(MockRead* reads, |
| 170 size_t reads_count, | 170 size_t reads_count, |
| 171 MockWrite* writes, | 171 MockWrite* writes, |
| 172 size_t writes_count) { | 172 size_t writes_count) { |
| 173 data_ = new DeterministicSocketData(reads, reads_count, writes, writes_count); | 173 data_.reset(new DeterministicSocketData(reads, reads_count, |
| 174 writes, writes_count)); |
| 174 data_->set_connect_data(connect_data_); | 175 data_->set_connect_data(connect_data_); |
| 175 data_->SetStop(2); | 176 data_->SetStop(2); |
| 176 | 177 |
| 177 session_deps_.deterministic_socket_factory->AddSocketDataProvider( | 178 session_deps_.deterministic_socket_factory->AddSocketDataProvider( |
| 178 data_.get()); | 179 data_.get()); |
| 179 session_deps_.host_resolver->set_synchronous_mode(true); | 180 session_deps_.host_resolver->set_synchronous_mode(true); |
| 180 | 181 |
| 181 session_ = SpdySessionDependencies::SpdyCreateSessionDeterministic( | 182 session_ = SpdySessionDependencies::SpdyCreateSessionDeterministic( |
| 182 &session_deps_); | 183 &session_deps_); |
| 183 | 184 |
| (...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1310 write_callback_.callback())); | 1311 write_callback_.callback())); |
| 1311 | 1312 |
| 1312 Run(2); | 1313 Run(2); |
| 1313 | 1314 |
| 1314 EXPECT_FALSE(sock_.get()); | 1315 EXPECT_FALSE(sock_.get()); |
| 1315 EXPECT_TRUE(read_callback.have_result()); | 1316 EXPECT_TRUE(read_callback.have_result()); |
| 1316 EXPECT_FALSE(write_callback_.have_result()); | 1317 EXPECT_FALSE(write_callback_.have_result()); |
| 1317 } | 1318 } |
| 1318 | 1319 |
| 1319 } // namespace net | 1320 } // namespace net |
| OLD | NEW |