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

Unified Diff: net/url_request/url_request_unittest.cc

Issue 2176183003: Revert of Enable Expect-Staple in SSLClientSocket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ocsp-reporting
Patch Set: Created 4 years, 5 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/socket/ssl_client_socket_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_unittest.cc
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc
index f589a9ce9d80fed1b40fe07788c71afc35b174c5..7a5805bc73efef4e40a78290ac41abde01708f26 100644
--- a/net/url_request/url_request_unittest.cc
+++ b/net/url_request/url_request_unittest.cc
@@ -5960,8 +5960,6 @@
namespace {
const char kExpectCTStaticHostname[] = "preloaded-expect-ct.badssl.com";
-const char kExpectStapleStaticHostname[] = "preloaded-expect-staple.badssl.com";
-const char kExpectStapleReportURI[] = "https://report.badssl.com/expect-staple";
const char kHPKPReportUri[] = "https://hpkp-report.test";
} // namespace
@@ -9239,110 +9237,6 @@
EXPECT_TRUE(cert_status & CERT_STATUS_REV_CHECKING_ENABLED);
}
-TEST_F(HTTPSOCSPTest, ExpectStapleReportSentOnMissing) {
- EmbeddedTestServer https_test_server(net::EmbeddedTestServer::TYPE_HTTPS);
- https_test_server.SetSSLConfig(
- net::EmbeddedTestServer::CERT_COMMON_NAME_IS_DOMAIN);
- https_test_server.ServeFilesFromSourceDirectory(
- base::FilePath(kTestFilePath));
- ASSERT_TRUE(https_test_server.Start());
-
- // Set up a MockCertVerifier to accept the certificate that the server sends,
- // but not provide any OCSP information.
- scoped_refptr<X509Certificate> cert = https_test_server.GetCertificate();
- ASSERT_TRUE(cert);
- MockCertVerifier cert_verifier;
- CertVerifyResult verify_result;
- verify_result.verified_cert = cert;
- verify_result.is_issued_by_known_root = true;
- verify_result.ocsp_result.response_status = OCSPVerifyResult::MISSING;
- cert_verifier.AddResultForCert(cert.get(), verify_result, OK);
-
- // Catch the Expect-Staple report.
- TransportSecurityState transport_security_state;
- MockCertificateReportSender mock_report_sender;
- transport_security_state.SetReportSender(&mock_report_sender);
-
- // Use a MockHostResolver (which by default maps all hosts to 127.0.0.1) so
- // that the request can be sent to a site on the Expect-Staple preload list.
- MockHostResolver host_resolver;
- TestNetworkDelegate network_delegate;
- TestURLRequestContext context(true);
- context.set_host_resolver(&host_resolver);
- context.set_transport_security_state(&transport_security_state);
- context.set_network_delegate(&network_delegate);
- context.set_cert_verifier(&cert_verifier);
- context.Init();
-
- // Now send a request to trigger the violation.
- TestDelegate d;
- GURL url = https_test_server.GetURL("/");
- GURL::Replacements replace_host;
- replace_host.SetHostStr(kExpectStapleStaticHostname);
- url = url.ReplaceComponents(replace_host);
- std::unique_ptr<URLRequest> violating_request(
- context.CreateRequest(url, DEFAULT_PRIORITY, &d));
- violating_request->Start();
- base::RunLoop().Run();
-
- // Confirm a report was sent.
- EXPECT_FALSE(mock_report_sender.latest_report().empty());
- EXPECT_EQ(GURL(kExpectStapleReportURI),
- mock_report_sender.latest_report_uri());
-}
-
-TEST_F(HTTPSOCSPTest, ExpectStapleReportNotSentOnValid) {
- EmbeddedTestServer https_test_server(net::EmbeddedTestServer::TYPE_HTTPS);
- https_test_server.SetSSLConfig(
- net::EmbeddedTestServer::CERT_COMMON_NAME_IS_DOMAIN);
- https_test_server.ServeFilesFromSourceDirectory(
- base::FilePath(kTestFilePath));
- ASSERT_TRUE(https_test_server.Start());
-
- // Set up a MockCertVerifier to accept the certificate that the server sends,
- // and provide GOOD revocation status.
- scoped_refptr<X509Certificate> cert = https_test_server.GetCertificate();
- ASSERT_TRUE(cert);
- MockCertVerifier cert_verifier;
- CertVerifyResult verify_result;
- verify_result.verified_cert = cert;
- verify_result.is_issued_by_known_root = true;
- verify_result.ocsp_result.response_status = OCSPVerifyResult::PROVIDED;
- verify_result.ocsp_result.revocation_status = OCSPRevocationStatus::GOOD;
- cert_verifier.AddResultForCert(cert.get(), verify_result, OK);
-
- // Catch the Expect-Staple report.
- TransportSecurityState transport_security_state;
- MockCertificateReportSender mock_report_sender;
- transport_security_state.SetReportSender(&mock_report_sender);
-
- // Use a MockHostResolver (which by default maps all hosts to 127.0.0.1) so
- // that the request can be sent to a site on the Expect-Staple preload list.
- MockHostResolver host_resolver;
- TestNetworkDelegate network_delegate;
- TestURLRequestContext context(true);
- context.set_host_resolver(&host_resolver);
- context.set_transport_security_state(&transport_security_state);
- context.set_network_delegate(&network_delegate);
- context.set_cert_verifier(&cert_verifier);
- context.Init();
-
- // This request should not not trigger an Expect-Staple violation.
- TestDelegate d;
- GURL url = https_test_server.GetURL("/");
- GURL::Replacements replace_host;
- replace_host.SetHostStr(kExpectStapleStaticHostname);
- url = url.ReplaceComponents(replace_host);
- std::unique_ptr<URLRequest> ok_request(
- context.CreateRequest(url, DEFAULT_PRIORITY, &d));
- ok_request->Start();
- base::RunLoop().Run();
-
- // Check that no report was sent.
- EXPECT_TRUE(mock_report_sender.latest_report().empty());
- EXPECT_EQ(GURL(), mock_report_sender.latest_report_uri());
-}
-
static const struct OCSPVerifyTestData {
std::vector<SpawnedTestServer::SSLOptions::OCSPSingleResponse> ocsp_responses;
SpawnedTestServer::SSLOptions::OCSPProduced ocsp_produced;
« no previous file with comments | « net/socket/ssl_client_socket_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698