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

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

Issue 22794008: Remove deprecated functions that take StreamSockets instead of handles (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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) 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 // Certificate provided by the host doesn't need authority. 337 // Certificate provided by the host doesn't need authority.
338 net::SSLConfig::CertAndStatus cert_and_status; 338 net::SSLConfig::CertAndStatus cert_and_status;
339 cert_and_status.cert_status = CERT_STATUS_AUTHORITY_INVALID; 339 cert_and_status.cert_status = CERT_STATUS_AUTHORITY_INVALID;
340 cert_and_status.der_cert = cert_der; 340 cert_and_status.der_cert = cert_der;
341 ssl_config.allowed_bad_certs.push_back(cert_and_status); 341 ssl_config.allowed_bad_certs.push_back(cert_and_status);
342 342
343 net::HostPortPair host_and_pair("unittest", 0); 343 net::HostPortPair host_and_pair("unittest", 0);
344 net::SSLClientSocketContext context; 344 net::SSLClientSocketContext context;
345 context.cert_verifier = cert_verifier_.get(); 345 context.cert_verifier = cert_verifier_.get();
346 context.transport_security_state = transport_security_state_.get(); 346 context.transport_security_state = transport_security_state_.get();
347 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle);
348 connection->set_socket(fake_client_socket);
347 client_socket_.reset( 349 client_socket_.reset(
348 socket_factory_->CreateSSLClientSocket( 350 socket_factory_->CreateSSLClientSocket(
349 fake_client_socket, host_and_pair, ssl_config, context)); 351 connection.release(), host_and_pair, ssl_config, context));
350 server_socket_.reset(net::CreateSSLServerSocket( 352 server_socket_.reset(net::CreateSSLServerSocket(
351 fake_server_socket, cert.get(), private_key.get(), net::SSLConfig())); 353 fake_server_socket, cert.get(), private_key.get(), net::SSLConfig()));
352 } 354 }
353 355
354 FakeDataChannel channel_1_; 356 FakeDataChannel channel_1_;
355 FakeDataChannel channel_2_; 357 FakeDataChannel channel_2_;
356 scoped_ptr<net::SSLClientSocket> client_socket_; 358 scoped_ptr<net::SSLClientSocket> client_socket_;
357 scoped_ptr<net::SSLServerSocket> server_socket_; 359 scoped_ptr<net::SSLServerSocket> server_socket_;
358 net::ClientSocketFactory* socket_factory_; 360 net::ClientSocketFactory* socket_factory_;
359 scoped_ptr<net::MockCertVerifier> cert_verifier_; 361 scoped_ptr<net::MockCertVerifier> cert_verifier_;
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 unsigned char client_bad[kKeyingMaterialSize]; 577 unsigned char client_bad[kKeyingMaterialSize];
576 rv = client_socket_->ExportKeyingMaterial(kKeyingLabelBad, 578 rv = client_socket_->ExportKeyingMaterial(kKeyingLabelBad,
577 false, kKeyingContext, 579 false, kKeyingContext,
578 client_bad, sizeof(client_bad)); 580 client_bad, sizeof(client_bad));
579 ASSERT_EQ(rv, net::OK); 581 ASSERT_EQ(rv, net::OK);
580 EXPECT_NE(0, memcmp(server_out, client_bad, sizeof(server_out))); 582 EXPECT_NE(0, memcmp(server_out, client_bad, sizeof(server_out)));
581 } 583 }
582 #endif 584 #endif
583 585
584 } // namespace net 586 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698