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

Unified Diff: net/socket/ssl_client_socket_unittest.cc

Issue 2758803003: Make X509Certificate creation fail if X509Certificate::Initialize fails. (Closed)
Patch Set: test updatess 2 Created 3 years, 9 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 | « net/cert/x509_util_nss.cc ('k') | net/test/embedded_test_server/embedded_test_server_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_unittest.cc
diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc
index 44f4a9d005e2e44c353415cfbcda4b59daa12e34..b5fd0a906cec9859d4fcca4579df26db94f61905 100644
--- a/net/socket/ssl_client_socket_unittest.cc
+++ b/net/socket/ssl_client_socket_unittest.cc
@@ -78,6 +78,7 @@ using net::test::IsError;
using net::test::IsOk;
using testing::_;
+using testing::AnyOf;
using testing::Return;
using testing::Truly;
@@ -1293,7 +1294,6 @@ TEST_F(SSLClientSocketTest, ConnectMismatched) {
EXPECT_TRUE(LogContainsEndEvent(entries, -1, NetLogEventType::SSL_CONNECT));
}
-#if defined(OS_WIN)
// Tests that certificates parsable by SSLClientSocket's internal SSL
// implementation, but not X509Certificate are treated as fatal connection
// errors. This is a regression test for https://crbug.com/91341.
@@ -1301,14 +1301,23 @@ TEST_F(SSLClientSocketTest, ConnectBadValidity) {
SpawnedTestServer::SSLOptions ssl_options(
SpawnedTestServer::SSLOptions::CERT_BAD_VALIDITY);
ASSERT_TRUE(StartTestServer(ssl_options));
+ cert_verifier_->set_default_result(ERR_CERT_DATE_INVALID);
+
SSLConfig ssl_config;
int rv;
ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv));
+#if defined(OS_WIN)
EXPECT_THAT(rv, IsError(ERR_SSL_SERVER_CERT_BAD_FORMAT));
EXPECT_FALSE(IsCertificateError(rv));
+#elif defined(OS_ANDROID)
+ // Android date handling behavior can vary depending on the platform.
+ EXPECT_THAT(rv, AnyOf(IsError(ERR_SSL_SERVER_CERT_BAD_FORMAT),
+ IsError(ERR_CERT_DATE_INVALID)));
+#else // !(defined(OS_WIN) || defined(OS_ANDROID))
+ EXPECT_THAT(rv, IsError(ERR_CERT_DATE_INVALID));
+#endif
}
-#endif // defined(OS_WIN)
// Attempt to connect to a page which requests a client certificate. It should
// return an error code on connect.
« no previous file with comments | « net/cert/x509_util_nss.cc ('k') | net/test/embedded_test_server/embedded_test_server_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698