| 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 "jingle/glue/fake_ssl_client_socket.h" | 5 #include "jingle/glue/fake_ssl_client_socket.h" |
| 6 | 6 |
| 7 #include <cstdlib> | 7 #include <cstdlib> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 } | 193 } |
| 194 | 194 |
| 195 void FakeSSLClientSocket::ProcessConnectDone() { | 195 void FakeSSLClientSocket::ProcessConnectDone() { |
| 196 DCHECK_EQ(write_buf_->BytesConsumed(), 0); | 196 DCHECK_EQ(write_buf_->BytesConsumed(), 0); |
| 197 DCHECK_EQ(read_buf_->BytesConsumed(), 0); | 197 DCHECK_EQ(read_buf_->BytesConsumed(), 0); |
| 198 next_handshake_state_ = STATE_SEND_CLIENT_HELLO; | 198 next_handshake_state_ = STATE_SEND_CLIENT_HELLO; |
| 199 } | 199 } |
| 200 | 200 |
| 201 int FakeSSLClientSocket::DoSendClientHello() { | 201 int FakeSSLClientSocket::DoSendClientHello() { |
| 202 int status = transport_socket_->Write( | 202 int status = transport_socket_->Write( |
| 203 write_buf_, write_buf_->BytesRemaining(), | 203 write_buf_.get(), |
| 204 write_buf_->BytesRemaining(), |
| 204 base::Bind(&FakeSSLClientSocket::OnSendClientHelloDone, | 205 base::Bind(&FakeSSLClientSocket::OnSendClientHelloDone, |
| 205 base::Unretained(this))); | 206 base::Unretained(this))); |
| 206 if (status < net::OK) { | 207 if (status < net::OK) { |
| 207 return status; | 208 return status; |
| 208 } | 209 } |
| 209 ProcessSendClientHelloDone(static_cast<size_t>(status)); | 210 ProcessSendClientHelloDone(static_cast<size_t>(status)); |
| 210 return net::OK; | 211 return net::OK; |
| 211 } | 212 } |
| 212 | 213 |
| 213 void FakeSSLClientSocket::OnSendClientHelloDone(int status) { | 214 void FakeSSLClientSocket::OnSendClientHelloDone(int status) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 227 if (written < static_cast<size_t>(write_buf_->BytesRemaining())) { | 228 if (written < static_cast<size_t>(write_buf_->BytesRemaining())) { |
| 228 next_handshake_state_ = STATE_SEND_CLIENT_HELLO; | 229 next_handshake_state_ = STATE_SEND_CLIENT_HELLO; |
| 229 write_buf_->DidConsume(written); | 230 write_buf_->DidConsume(written); |
| 230 } else { | 231 } else { |
| 231 next_handshake_state_ = STATE_VERIFY_SERVER_HELLO; | 232 next_handshake_state_ = STATE_VERIFY_SERVER_HELLO; |
| 232 } | 233 } |
| 233 } | 234 } |
| 234 | 235 |
| 235 int FakeSSLClientSocket::DoVerifyServerHello() { | 236 int FakeSSLClientSocket::DoVerifyServerHello() { |
| 236 int status = transport_socket_->Read( | 237 int status = transport_socket_->Read( |
| 237 read_buf_, read_buf_->BytesRemaining(), | 238 read_buf_.get(), |
| 239 read_buf_->BytesRemaining(), |
| 238 base::Bind(&FakeSSLClientSocket::OnVerifyServerHelloDone, | 240 base::Bind(&FakeSSLClientSocket::OnVerifyServerHelloDone, |
| 239 base::Unretained(this))); | 241 base::Unretained(this))); |
| 240 if (status < net::OK) { | 242 if (status < net::OK) { |
| 241 return status; | 243 return status; |
| 242 } | 244 } |
| 243 size_t read = static_cast<size_t>(status); | 245 size_t read = static_cast<size_t>(status); |
| 244 return ProcessVerifyServerHelloDone(read); | 246 return ProcessVerifyServerHelloDone(read); |
| 245 } | 247 } |
| 246 | 248 |
| 247 void FakeSSLClientSocket::OnVerifyServerHelloDone(int status) { | 249 void FakeSSLClientSocket::OnVerifyServerHelloDone(int status) { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 | 338 |
| 337 net::NextProto FakeSSLClientSocket::GetNegotiatedProtocol() const { | 339 net::NextProto FakeSSLClientSocket::GetNegotiatedProtocol() const { |
| 338 return transport_socket_->GetNegotiatedProtocol(); | 340 return transport_socket_->GetNegotiatedProtocol(); |
| 339 } | 341 } |
| 340 | 342 |
| 341 bool FakeSSLClientSocket::GetSSLInfo(net::SSLInfo* ssl_info) { | 343 bool FakeSSLClientSocket::GetSSLInfo(net::SSLInfo* ssl_info) { |
| 342 return transport_socket_->GetSSLInfo(ssl_info); | 344 return transport_socket_->GetSSLInfo(ssl_info); |
| 343 } | 345 } |
| 344 | 346 |
| 345 } // namespace jingle_glue | 347 } // namespace jingle_glue |
| OLD | NEW |