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

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

Issue 2300533002: Stop caching DER-encoded certificates unnecessarily (Closed)
Patch Set: Remove debug Created 4 years, 3 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
« no previous file with comments | « net/socket/ssl_client_socket_unittest.cc ('k') | net/ssl/ssl_config.h » ('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) 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 // 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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 server_cert_ = 388 server_cert_ =
389 ImportCertFromFile(GetTestCertsDirectory(), "unittest.selfsigned.der"); 389 ImportCertFromFile(GetTestCertsDirectory(), "unittest.selfsigned.der");
390 ASSERT_TRUE(server_cert_); 390 ASSERT_TRUE(server_cert_);
391 server_private_key_ = ReadTestKey("unittest.key.bin"); 391 server_private_key_ = ReadTestKey("unittest.key.bin");
392 ASSERT_TRUE(server_private_key_); 392 ASSERT_TRUE(server_private_key_);
393 393
394 client_ssl_config_.false_start_enabled = false; 394 client_ssl_config_.false_start_enabled = false;
395 client_ssl_config_.channel_id_enabled = false; 395 client_ssl_config_.channel_id_enabled = false;
396 396
397 // Certificate provided by the host doesn't need authority. 397 // Certificate provided by the host doesn't need authority.
398 SSLConfig::CertAndStatus cert_and_status; 398 client_ssl_config_.allowed_bad_certs.emplace_back(
399 cert_and_status.cert_status = CERT_STATUS_AUTHORITY_INVALID; 399 server_cert_, CERT_STATUS_AUTHORITY_INVALID);
400 std::string server_cert_der;
401 ASSERT_TRUE(X509Certificate::GetDEREncoded(server_cert_->os_cert_handle(),
402 &server_cert_der));
403 cert_and_status.der_cert = server_cert_der;
404 client_ssl_config_.allowed_bad_certs.push_back(cert_and_status);
405 } 400 }
406 401
407 protected: 402 protected:
408 void CreateContext() { 403 void CreateContext() {
409 client_socket_.reset(); 404 client_socket_.reset();
410 server_socket_.reset(); 405 server_socket_.reset();
411 channel_1_.reset(); 406 channel_1_.reset();
412 channel_2_.reset(); 407 channel_2_.reset();
413 server_context_.reset(); 408 server_context_.reset();
414 server_context_ = CreateSSLServerContext( 409 server_context_ = CreateSSLServerContext(
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 int server_ret = server_socket_->Handshake(handshake_callback.callback()); 1113 int server_ret = server_socket_->Handshake(handshake_callback.callback());
1119 1114
1120 client_ret = connect_callback.GetResult(client_ret); 1115 client_ret = connect_callback.GetResult(client_ret);
1121 server_ret = handshake_callback.GetResult(server_ret); 1116 server_ret = handshake_callback.GetResult(server_ret);
1122 1117
1123 ASSERT_THAT(client_ret, IsError(ERR_SSL_VERSION_OR_CIPHER_MISMATCH)); 1118 ASSERT_THAT(client_ret, IsError(ERR_SSL_VERSION_OR_CIPHER_MISMATCH));
1124 ASSERT_THAT(server_ret, IsError(ERR_SSL_VERSION_OR_CIPHER_MISMATCH)); 1119 ASSERT_THAT(server_ret, IsError(ERR_SSL_VERSION_OR_CIPHER_MISMATCH));
1125 } 1120 }
1126 1121
1127 } // namespace net 1122 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_unittest.cc ('k') | net/ssl/ssl_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698