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 // This test suite uses SSLClientSocket to test the implementation of | 5 // This test suite uses SSLClientSocket to test the implementation of |
6 // SSLServerSocket. In order to establish connections between the sockets | 6 // SSLServerSocket. In order to establish connections between the sockets |
7 // we need two additional classes: | 7 // we need two additional classes: |
8 // 1. FakeSocket | 8 // 1. FakeSocket |
9 // Connects SSL socket to FakeDataChannel. This class is just a stub. | 9 // Connects SSL socket to FakeDataChannel. This class is just a stub. |
10 // | 10 // |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 255 |
256 net::SSLConfig ssl_config; | 256 net::SSLConfig ssl_config; |
257 ssl_config.cached_info_enabled = false; | 257 ssl_config.cached_info_enabled = false; |
258 ssl_config.false_start_enabled = false; | 258 ssl_config.false_start_enabled = false; |
259 ssl_config.ssl3_enabled = true; | 259 ssl_config.ssl3_enabled = true; |
260 ssl_config.tls1_enabled = true; | 260 ssl_config.tls1_enabled = true; |
261 | 261 |
262 // Certificate provided by the host doesn't need authority. | 262 // Certificate provided by the host doesn't need authority. |
263 net::SSLConfig::CertAndStatus cert_and_status; | 263 net::SSLConfig::CertAndStatus cert_and_status; |
264 cert_and_status.cert_status = CERT_STATUS_AUTHORITY_INVALID; | 264 cert_and_status.cert_status = CERT_STATUS_AUTHORITY_INVALID; |
265 cert_and_status.cert = cert; | 265 cert_and_status.der_cert = cert_der; |
266 ssl_config.allowed_bad_certs.push_back(cert_and_status); | 266 ssl_config.allowed_bad_certs.push_back(cert_and_status); |
267 | 267 |
268 net::HostPortPair host_and_pair("unittest", 0); | 268 net::HostPortPair host_and_pair("unittest", 0); |
269 client_socket_.reset( | 269 client_socket_.reset( |
270 socket_factory_->CreateSSLClientSocket( | 270 socket_factory_->CreateSSLClientSocket( |
271 fake_client_socket, host_and_pair, ssl_config, NULL, | 271 fake_client_socket, host_and_pair, ssl_config, NULL, |
272 &cert_verifier_)); | 272 &cert_verifier_)); |
273 server_socket_.reset(net::CreateSSLServerSocket(fake_server_socket, | 273 server_socket_.reset(net::CreateSSLServerSocket(fake_server_socket, |
274 cert, private_key.get(), | 274 cert, private_key.get(), |
275 net::SSLConfig())); | 275 net::SSLConfig())); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 EXPECT_GT(read_callback.WaitForResult(), 0); | 375 EXPECT_GT(read_callback.WaitForResult(), 0); |
376 } | 376 } |
377 if (client_ret == net::ERR_IO_PENDING) { | 377 if (client_ret == net::ERR_IO_PENDING) { |
378 EXPECT_GT(write_callback.WaitForResult(), 0); | 378 EXPECT_GT(write_callback.WaitForResult(), 0); |
379 } | 379 } |
380 EXPECT_EQ(0, memcmp(write_buf->data(), read_buf->data(), write_buf->size())); | 380 EXPECT_EQ(0, memcmp(write_buf->data(), read_buf->data(), write_buf->size())); |
381 } | 381 } |
382 #endif | 382 #endif |
383 | 383 |
384 } // namespace net | 384 } // namespace net |
OLD | NEW |