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

Unified Diff: net/socket/ssl_client_socket_openssl_unittest.cc

Issue 263213005: Move channel id tests up from OpenSSL and update channelid version. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Accept all error codes in SSLClientSocketChannelIDTest.FailingChannelID 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « DEPS ('k') | net/socket/ssl_client_socket_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/ssl_client_socket_openssl_unittest.cc
diff --git a/net/socket/ssl_client_socket_openssl_unittest.cc b/net/socket/ssl_client_socket_openssl_unittest.cc
index 91c9a93aa7eb3c1af8b230436d79c002dd5df4b2..00cf9f35cb4b612841207513f112780a405880df 100644
--- a/net/socket/ssl_client_socket_openssl_unittest.cc
+++ b/net/socket/ssl_client_socket_openssl_unittest.cc
@@ -35,9 +35,7 @@
#include "net/socket/client_socket_handle.h"
#include "net/socket/socket_test_util.h"
#include "net/socket/tcp_client_socket.h"
-#include "net/ssl/default_server_bound_cert_store.h"
#include "net/ssl/openssl_client_key_store.h"
-#include "net/ssl/server_bound_cert_service.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "net/ssl/ssl_config_service.h"
#include "net/test/cert_test_util.h"
@@ -64,35 +62,6 @@ typedef crypto::ScopedOpenSSL<BIGNUM, BN_free> ScopedBIGNUM;
const SSLConfig kDefaultSSLConfig;
-// A ServerBoundCertStore that always returns an error when asked for a
-// certificate.
-class FailingServerBoundCertStore : public ServerBoundCertStore {
- virtual int GetServerBoundCert(const std::string& server_identifier,
- base::Time* expiration_time,
- std::string* private_key_result,
- std::string* cert_result,
- const GetCertCallback& callback) OVERRIDE {
- return ERR_UNEXPECTED;
- }
- virtual void SetServerBoundCert(const std::string& server_identifier,
- base::Time creation_time,
- base::Time expiration_time,
- const std::string& private_key,
- const std::string& cert) OVERRIDE {}
- virtual void DeleteServerBoundCert(const std::string& server_identifier,
- const base::Closure& completion_callback)
- OVERRIDE {}
- virtual void DeleteAllCreatedBetween(base::Time delete_begin,
- base::Time delete_end,
- const base::Closure& completion_callback)
- OVERRIDE {}
- virtual void DeleteAll(const base::Closure& completion_callback) OVERRIDE {}
- virtual void GetAllServerBoundCerts(const GetCertListCallback& callback)
- OVERRIDE {}
- virtual int GetCertCount() OVERRIDE { return 0; }
- virtual void SetForceKeepSessionState() OVERRIDE {}
-};
-
// Loads a PEM-encoded private key file into a scoped EVP_PKEY object.
// |filepath| is the private key file path.
// |*pkey| is reset to the new EVP_PKEY on success, untouched otherwise.
@@ -141,20 +110,6 @@ class SSLClientSocketOpenSSLClientAuthTest : public PlatformTest {
}
protected:
- void EnabledChannelID() {
- cert_service_.reset(
- new ServerBoundCertService(new DefaultServerBoundCertStore(NULL),
- base::MessageLoopProxy::current()));
- context_.server_bound_cert_service = cert_service_.get();
- }
-
- void EnabledFailingChannelID() {
- cert_service_.reset(
- new ServerBoundCertService(new FailingServerBoundCertStore(),
- base::MessageLoopProxy::current()));
- context_.server_bound_cert_service = cert_service_.get();
- }
-
scoped_ptr<SSLClientSocket> CreateSSLClientSocket(
scoped_ptr<StreamSocket> transport_socket,
const HostPortPair& host_and_port,
@@ -236,7 +191,6 @@ class SSLClientSocketOpenSSLClientAuthTest : public PlatformTest {
return ssl_info.client_cert_sent;
}
- scoped_ptr<ServerBoundCertService> cert_service_;
ClientSocketFactory* socket_factory_;
scoped_ptr<MockCertVerifier> cert_verifier_;
scoped_ptr<TransportSecurityState> transport_security_state_;
@@ -323,45 +277,6 @@ TEST_F(SSLClientSocketOpenSSLClientAuthTest, SendGoodCert) {
sock_->Disconnect();
EXPECT_FALSE(sock_->IsConnected());
}
-
-// Connect to a server using channel id. It should allow the connection.
-TEST_F(SSLClientSocketOpenSSLClientAuthTest, SendChannelID) {
- SpawnedTestServer::SSLOptions ssl_options;
-
- ASSERT_TRUE(ConnectToTestServer(ssl_options));
-
- EnabledChannelID();
- SSLConfig ssl_config = kDefaultSSLConfig;
- ssl_config.channel_id_enabled = true;
-
- int rv;
- ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv));
-
- EXPECT_EQ(OK, rv);
- EXPECT_TRUE(sock_->IsConnected());
- EXPECT_TRUE(sock_->WasChannelIDSent());
-
- sock_->Disconnect();
- EXPECT_FALSE(sock_->IsConnected());
-}
-
-// Connect to a server using channel id but without sending a key. It should
-// fail.
-TEST_F(SSLClientSocketOpenSSLClientAuthTest, FailingChannelID) {
- SpawnedTestServer::SSLOptions ssl_options;
-
- ASSERT_TRUE(ConnectToTestServer(ssl_options));
-
- EnabledFailingChannelID();
- SSLConfig ssl_config = kDefaultSSLConfig;
- ssl_config.channel_id_enabled = true;
-
- int rv;
- ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv));
-
- EXPECT_EQ(ERR_UNEXPECTED, rv);
- EXPECT_FALSE(sock_->IsConnected());
-}
#endif // defined(USE_OPENSSL_CERTS)
} // namespace
« no previous file with comments | « DEPS ('k') | net/socket/ssl_client_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698