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