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

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

Issue 274783002: Implement SSL server socket over OpenSSL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for some comments. Created 6 years, 7 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_server_socket_openssl.cc ('k') | no next file » | 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 354
355 FakeDataChannel channel_1_; 355 FakeDataChannel channel_1_;
356 FakeDataChannel channel_2_; 356 FakeDataChannel channel_2_;
357 scoped_ptr<net::SSLClientSocket> client_socket_; 357 scoped_ptr<net::SSLClientSocket> client_socket_;
358 scoped_ptr<net::SSLServerSocket> server_socket_; 358 scoped_ptr<net::SSLServerSocket> server_socket_;
359 net::ClientSocketFactory* socket_factory_; 359 net::ClientSocketFactory* socket_factory_;
360 scoped_ptr<net::MockCertVerifier> cert_verifier_; 360 scoped_ptr<net::MockCertVerifier> cert_verifier_;
361 scoped_ptr<net::TransportSecurityState> transport_security_state_; 361 scoped_ptr<net::TransportSecurityState> transport_security_state_;
362 }; 362 };
363 363
364 // SSLServerSocket is only implemented using NSS.
365 #if defined(USE_NSS) || defined(OS_WIN) || defined(OS_MACOSX)
366
367 // This test only executes creation of client and server sockets. This is to 364 // This test only executes creation of client and server sockets. This is to
368 // test that creation of sockets doesn't crash and have minimal code to run 365 // test that creation of sockets doesn't crash and have minimal code to run
369 // under valgrind in order to help debugging memory problems. 366 // under valgrind in order to help debugging memory problems.
370 TEST_F(SSLServerSocketTest, Initialize) { 367 TEST_F(SSLServerSocketTest, Initialize) {
371 Initialize(); 368 Initialize();
372 } 369 }
373 370
374 // This test executes Connect() on SSLClientSocket and Handshake() on 371 // This test executes Connect() on SSLClientSocket and Handshake() on
375 // SSLServerSocket to make sure handshaking between the two sockets is 372 // SSLServerSocket to make sure handshaking between the two sockets is
376 // completed successfully. 373 // completed successfully.
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 EXPECT_EQ(0, memcmp(server_out, client_out, sizeof(server_out))); 570 EXPECT_EQ(0, memcmp(server_out, client_out, sizeof(server_out)));
574 571
575 const char* kKeyingLabelBad = "EXPERIMENTAL-server-socket-test-bad"; 572 const char* kKeyingLabelBad = "EXPERIMENTAL-server-socket-test-bad";
576 unsigned char client_bad[kKeyingMaterialSize]; 573 unsigned char client_bad[kKeyingMaterialSize];
577 rv = client_socket_->ExportKeyingMaterial(kKeyingLabelBad, 574 rv = client_socket_->ExportKeyingMaterial(kKeyingLabelBad,
578 false, kKeyingContext, 575 false, kKeyingContext,
579 client_bad, sizeof(client_bad)); 576 client_bad, sizeof(client_bad));
580 ASSERT_EQ(rv, net::OK); 577 ASSERT_EQ(rv, net::OK);
581 EXPECT_NE(0, memcmp(server_out, client_bad, sizeof(server_out))); 578 EXPECT_NE(0, memcmp(server_out, client_bad, sizeof(server_out)));
582 } 579 }
583 #endif
584 580
585 } // namespace net 581 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_server_socket_openssl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698