Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: net/socket/ssl_server_socket_unittest.cc

Issue 6677022: Code cleanup related to allowed_bad_certs.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Include cert_status_flags.h Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/http/http_stream_factory_impl_job.cc ('k') | net/socket_stream/socket_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 //
11 // 2. FakeDataChannel 11 // 2. FakeDataChannel
12 // Implements the actual exchange of data between two FakeSockets. 12 // Implements the actual exchange of data between two FakeSockets.
13 // 13 //
14 // Implementations of these two classes are included in this file. 14 // Implementations of these two classes are included in this file.
15 15
16 #include "net/socket/ssl_server_socket.h" 16 #include "net/socket/ssl_server_socket.h"
17 17
18 #include <queue> 18 #include <queue>
19 19
20 #include "base/crypto/rsa_private_key.h" 20 #include "base/crypto/rsa_private_key.h"
21 #include "base/file_path.h" 21 #include "base/file_path.h"
22 #include "base/file_util.h" 22 #include "base/file_util.h"
23 #include "base/nss_util.h" 23 #include "base/nss_util.h"
24 #include "base/path_service.h" 24 #include "base/path_service.h"
25 #include "net/base/address_list.h" 25 #include "net/base/address_list.h"
26 #include "net/base/cert_status_flags.h"
26 #include "net/base/cert_verifier.h" 27 #include "net/base/cert_verifier.h"
27 #include "net/base/host_port_pair.h" 28 #include "net/base/host_port_pair.h"
28 #include "net/base/io_buffer.h" 29 #include "net/base/io_buffer.h"
29 #include "net/base/net_errors.h" 30 #include "net/base/net_errors.h"
30 #include "net/base/net_log.h" 31 #include "net/base/net_log.h"
31 #include "net/base/ssl_config_service.h" 32 #include "net/base/ssl_config_service.h"
32 #include "net/base/x509_certificate.h" 33 #include "net/base/x509_certificate.h"
33 #include "net/socket/client_socket.h" 34 #include "net/socket/client_socket.h"
34 #include "net/socket/client_socket_factory.h" 35 #include "net/socket/client_socket_factory.h"
35 #include "net/socket/socket_test_util.h" 36 #include "net/socket/socket_test_util.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 base::RSAPrivateKey::CreateFromPrivateKeyInfo(key_vector)); 238 base::RSAPrivateKey::CreateFromPrivateKeyInfo(key_vector));
238 239
239 net::SSLConfig ssl_config; 240 net::SSLConfig ssl_config;
240 ssl_config.false_start_enabled = false; 241 ssl_config.false_start_enabled = false;
241 ssl_config.snap_start_enabled = false; 242 ssl_config.snap_start_enabled = false;
242 ssl_config.ssl3_enabled = true; 243 ssl_config.ssl3_enabled = true;
243 ssl_config.tls1_enabled = true; 244 ssl_config.tls1_enabled = true;
244 245
245 // Certificate provided by the host doesn't need authority. 246 // Certificate provided by the host doesn't need authority.
246 net::SSLConfig::CertAndStatus cert_and_status; 247 net::SSLConfig::CertAndStatus cert_and_status;
247 cert_and_status.cert_status = net::ERR_CERT_AUTHORITY_INVALID; 248 cert_and_status.cert_status = net::CERT_STATUS_AUTHORITY_INVALID;
248 cert_and_status.cert = cert; 249 cert_and_status.cert = cert;
249 ssl_config.allowed_bad_certs.push_back(cert_and_status); 250 ssl_config.allowed_bad_certs.push_back(cert_and_status);
250 251
251 net::HostPortPair host_and_pair("unittest", 0); 252 net::HostPortPair host_and_pair("unittest", 0);
252 client_socket_.reset( 253 client_socket_.reset(
253 socket_factory_->CreateSSLClientSocket( 254 socket_factory_->CreateSSLClientSocket(
254 fake_client_socket, host_and_pair, ssl_config, NULL, 255 fake_client_socket, host_and_pair, ssl_config, NULL,
255 &cert_verifier_)); 256 &cert_verifier_));
256 server_socket_.reset(net::CreateSSLServerSocket(fake_server_socket, 257 server_socket_.reset(net::CreateSSLServerSocket(fake_server_socket,
257 cert, private_key.get(), 258 cert, private_key.get(),
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 EXPECT_GT(read_callback.WaitForResult(), 0); 354 EXPECT_GT(read_callback.WaitForResult(), 0);
354 } 355 }
355 if (client_ret == net::ERR_IO_PENDING) { 356 if (client_ret == net::ERR_IO_PENDING) {
356 EXPECT_GT(write_callback.WaitForResult(), 0); 357 EXPECT_GT(write_callback.WaitForResult(), 0);
357 } 358 }
358 EXPECT_EQ(0, memcmp(write_buf->data(), read_buf->data(), write_buf->size())); 359 EXPECT_EQ(0, memcmp(write_buf->data(), read_buf->data(), write_buf->size()));
359 } 360 }
360 #endif 361 #endif
361 362
362 } // namespace net 363 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl_job.cc ('k') | net/socket_stream/socket_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698