| OLD | NEW | 
|---|
| 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 29 matching lines...) Expand all  Loading... | 
| 40 #include "net/cert/cert_status_flags.h" | 40 #include "net/cert/cert_status_flags.h" | 
| 41 #include "net/cert/mock_cert_verifier.h" | 41 #include "net/cert/mock_cert_verifier.h" | 
| 42 #include "net/cert/x509_certificate.h" | 42 #include "net/cert/x509_certificate.h" | 
| 43 #include "net/http/transport_security_state.h" | 43 #include "net/http/transport_security_state.h" | 
| 44 #include "net/log/net_log.h" | 44 #include "net/log/net_log.h" | 
| 45 #include "net/socket/client_socket_factory.h" | 45 #include "net/socket/client_socket_factory.h" | 
| 46 #include "net/socket/socket_test_util.h" | 46 #include "net/socket/socket_test_util.h" | 
| 47 #include "net/socket/ssl_client_socket.h" | 47 #include "net/socket/ssl_client_socket.h" | 
| 48 #include "net/socket/stream_socket.h" | 48 #include "net/socket/stream_socket.h" | 
| 49 #include "net/ssl/ssl_cipher_suite_names.h" | 49 #include "net/ssl/ssl_cipher_suite_names.h" | 
| 50 #include "net/ssl/ssl_config_service.h" |  | 
| 51 #include "net/ssl/ssl_connection_status_flags.h" | 50 #include "net/ssl/ssl_connection_status_flags.h" | 
| 52 #include "net/ssl/ssl_info.h" | 51 #include "net/ssl/ssl_info.h" | 
|  | 52 #include "net/ssl/ssl_server_config.h" | 
| 53 #include "net/test/cert_test_util.h" | 53 #include "net/test/cert_test_util.h" | 
| 54 #include "testing/gtest/include/gtest/gtest.h" | 54 #include "testing/gtest/include/gtest/gtest.h" | 
| 55 #include "testing/platform_test.h" | 55 #include "testing/platform_test.h" | 
| 56 | 56 | 
| 57 namespace net { | 57 namespace net { | 
| 58 | 58 | 
| 59 namespace { | 59 namespace { | 
| 60 | 60 | 
| 61 class FakeDataChannel { | 61 class FakeDataChannel { | 
| 62  public: | 62  public: | 
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 349     client_socket_ = socket_factory_->CreateSSLClientSocket( | 349     client_socket_ = socket_factory_->CreateSSLClientSocket( | 
| 350         client_connection.Pass(), host_and_pair, client_ssl_config_, context); | 350         client_connection.Pass(), host_and_pair, client_ssl_config_, context); | 
| 351     server_socket_ = | 351     server_socket_ = | 
| 352         CreateSSLServerSocket(server_socket.Pass(), cert.get(), | 352         CreateSSLServerSocket(server_socket.Pass(), cert.get(), | 
| 353                               private_key.get(), server_ssl_config_); | 353                               private_key.get(), server_ssl_config_); | 
| 354   } | 354   } | 
| 355 | 355 | 
| 356   FakeDataChannel channel_1_; | 356   FakeDataChannel channel_1_; | 
| 357   FakeDataChannel channel_2_; | 357   FakeDataChannel channel_2_; | 
| 358   SSLConfig client_ssl_config_; | 358   SSLConfig client_ssl_config_; | 
| 359   SSLConfig server_ssl_config_; | 359   SSLServerConfig server_ssl_config_; | 
| 360   scoped_ptr<SSLClientSocket> client_socket_; | 360   scoped_ptr<SSLClientSocket> client_socket_; | 
| 361   scoped_ptr<SSLServerSocket> server_socket_; | 361   scoped_ptr<SSLServerSocket> server_socket_; | 
| 362   ClientSocketFactory* socket_factory_; | 362   ClientSocketFactory* socket_factory_; | 
| 363   scoped_ptr<MockCertVerifier> cert_verifier_; | 363   scoped_ptr<MockCertVerifier> cert_verifier_; | 
| 364   scoped_ptr<TransportSecurityState> transport_security_state_; | 364   scoped_ptr<TransportSecurityState> transport_security_state_; | 
| 365 }; | 365 }; | 
| 366 | 366 | 
| 367 // This test only executes creation of client and server sockets. This is to | 367 // 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 | 368 // test that creation of sockets doesn't crash and have minimal code to run | 
| 369 // under valgrind in order to help debugging memory problems. | 369 // under valgrind in order to help debugging memory problems. | 
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 621   int server_ret = server_socket_->Handshake(handshake_callback.callback()); | 621   int server_ret = server_socket_->Handshake(handshake_callback.callback()); | 
| 622 | 622 | 
| 623   client_ret = connect_callback.GetResult(client_ret); | 623   client_ret = connect_callback.GetResult(client_ret); | 
| 624   server_ret = handshake_callback.GetResult(server_ret); | 624   server_ret = handshake_callback.GetResult(server_ret); | 
| 625 | 625 | 
| 626   ASSERT_EQ(ERR_SSL_VERSION_OR_CIPHER_MISMATCH, client_ret); | 626   ASSERT_EQ(ERR_SSL_VERSION_OR_CIPHER_MISMATCH, client_ret); | 
| 627   ASSERT_EQ(ERR_SSL_VERSION_OR_CIPHER_MISMATCH, server_ret); | 627   ASSERT_EQ(ERR_SSL_VERSION_OR_CIPHER_MISMATCH, server_ret); | 
| 628 } | 628 } | 
| 629 | 629 | 
| 630 }  // namespace net | 630 }  // namespace net | 
| OLD | NEW | 
|---|