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

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

Issue 9476035: Make CertVerifier a pure virtual interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
OLDNEW
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 10 matching lines...) Expand all
21 21
22 #include "base/compiler_specific.h" 22 #include "base/compiler_specific.h"
23 #include "base/file_path.h" 23 #include "base/file_path.h"
24 #include "base/file_util.h" 24 #include "base/file_util.h"
25 #include "base/message_loop.h" 25 #include "base/message_loop.h"
26 #include "base/path_service.h" 26 #include "base/path_service.h"
27 #include "crypto/nss_util.h" 27 #include "crypto/nss_util.h"
28 #include "crypto/rsa_private_key.h" 28 #include "crypto/rsa_private_key.h"
29 #include "net/base/address_list.h" 29 #include "net/base/address_list.h"
30 #include "net/base/cert_status_flags.h" 30 #include "net/base/cert_status_flags.h"
31 #include "net/base/cert_verifier.h"
32 #include "net/base/completion_callback.h" 31 #include "net/base/completion_callback.h"
33 #include "net/base/host_port_pair.h" 32 #include "net/base/host_port_pair.h"
34 #include "net/base/io_buffer.h" 33 #include "net/base/io_buffer.h"
35 #include "net/base/ip_endpoint.h" 34 #include "net/base/ip_endpoint.h"
35 #include "net/base/multi_threaded_cert_verifier.h"
36 #include "net/base/net_errors.h" 36 #include "net/base/net_errors.h"
37 #include "net/base/net_log.h" 37 #include "net/base/net_log.h"
38 #include "net/base/ssl_config_service.h" 38 #include "net/base/ssl_config_service.h"
39 #include "net/base/ssl_info.h" 39 #include "net/base/ssl_info.h"
40 #include "net/base/x509_certificate.h" 40 #include "net/base/x509_certificate.h"
41 #include "net/socket/client_socket_factory.h" 41 #include "net/socket/client_socket_factory.h"
42 #include "net/socket/socket_test_util.h" 42 #include "net/socket/socket_test_util.h"
43 #include "net/socket/ssl_client_socket.h" 43 #include "net/socket/ssl_client_socket.h"
44 #include "net/socket/stream_socket.h" 44 #include "net/socket/stream_socket.h"
45 #include "testing/gtest/include/gtest/gtest.h" 45 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 server_socket_.reset(net::CreateSSLServerSocket(fake_server_socket, 300 server_socket_.reset(net::CreateSSLServerSocket(fake_server_socket,
301 cert, private_key.get(), 301 cert, private_key.get(),
302 net::SSLConfig())); 302 net::SSLConfig()));
303 } 303 }
304 304
305 FakeDataChannel channel_1_; 305 FakeDataChannel channel_1_;
306 FakeDataChannel channel_2_; 306 FakeDataChannel channel_2_;
307 scoped_ptr<net::SSLClientSocket> client_socket_; 307 scoped_ptr<net::SSLClientSocket> client_socket_;
308 scoped_ptr<net::SSLServerSocket> server_socket_; 308 scoped_ptr<net::SSLServerSocket> server_socket_;
309 net::ClientSocketFactory* socket_factory_; 309 net::ClientSocketFactory* socket_factory_;
310 net::CertVerifier cert_verifier_; 310 net::MultiThreadedCertVerifier cert_verifier_;
311 }; 311 };
312 312
313 // SSLServerSocket is only implemented using NSS. 313 // SSLServerSocket is only implemented using NSS.
314 #if defined(USE_NSS) || defined(OS_WIN) || defined(OS_MACOSX) 314 #if defined(USE_NSS) || defined(OS_WIN) || defined(OS_MACOSX)
315 315
316 // This test only executes creation of client and server sockets. This is to 316 // This test only executes creation of client and server sockets. This is to
317 // test that creation of sockets doesn't crash and have minimal code to run 317 // test that creation of sockets doesn't crash and have minimal code to run
318 // under valgrind in order to help debugging memory problems. 318 // under valgrind in order to help debugging memory problems.
319 TEST_F(SSLServerSocketTest, Initialize) { 319 TEST_F(SSLServerSocketTest, Initialize) {
320 Initialize(); 320 Initialize();
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 const char* kKeyingLabelBad = "EXPERIMENTAL-server-socket-test-bad"; 468 const char* kKeyingLabelBad = "EXPERIMENTAL-server-socket-test-bad";
469 unsigned char client_bad[kKeyingMaterialSize]; 469 unsigned char client_bad[kKeyingMaterialSize];
470 rv = client_socket_->ExportKeyingMaterial(kKeyingLabelBad, kKeyingContext, 470 rv = client_socket_->ExportKeyingMaterial(kKeyingLabelBad, kKeyingContext,
471 client_bad, sizeof(client_bad)); 471 client_bad, sizeof(client_bad));
472 ASSERT_EQ(rv, net::OK); 472 ASSERT_EQ(rv, net::OK);
473 EXPECT_TRUE(memcmp(server_out, client_bad, sizeof(server_out)) != 0); 473 EXPECT_TRUE(memcmp(server_out, client_bad, sizeof(server_out)) != 0);
474 } 474 }
475 #endif 475 #endif
476 476
477 } // namespace net 477 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698