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 #include "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shlobj.h> | 9 #include <shlobj.h> |
10 #endif | 10 #endif |
(...skipping 5709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5720 DoConnection(ssl_options, &cert_status); | 5720 DoConnection(ssl_options, &cert_status); |
5721 | 5721 |
5722 EXPECT_EQ(ExpectedCertStatusForFailedOnlineRevocationCheck(), | 5722 EXPECT_EQ(ExpectedCertStatusForFailedOnlineRevocationCheck(), |
5723 cert_status & CERT_STATUS_ALL_ERRORS); | 5723 cert_status & CERT_STATUS_ALL_ERRORS); |
5724 | 5724 |
5725 EXPECT_FALSE(cert_status & CERT_STATUS_IS_EV); | 5725 EXPECT_FALSE(cert_status & CERT_STATUS_IS_EV); |
5726 EXPECT_EQ(SystemUsesChromiumEVMetadata(), | 5726 EXPECT_EQ(SystemUsesChromiumEVMetadata(), |
5727 static_cast<bool>(cert_status & CERT_STATUS_REV_CHECKING_ENABLED)); | 5727 static_cast<bool>(cert_status & CERT_STATUS_REV_CHECKING_ENABLED)); |
5728 } | 5728 } |
5729 | 5729 |
| 5730 TEST_F(HTTPSEVCRLSetTest, MissingCRLSetAndRevokedOCSP) { |
| 5731 if (!SystemSupportsOCSP()) { |
| 5732 LOG(WARNING) << "Skipping test because system doesn't support OCSP"; |
| 5733 return; |
| 5734 } |
| 5735 |
| 5736 SpawnedTestServer::SSLOptions ssl_options( |
| 5737 SpawnedTestServer::SSLOptions::CERT_AUTO); |
| 5738 ssl_options.ocsp_status = SpawnedTestServer::SSLOptions::OCSP_REVOKED; |
| 5739 SSLConfigService::SetCRLSet(scoped_refptr<CRLSet>()); |
| 5740 |
| 5741 CertStatus cert_status; |
| 5742 DoConnection(ssl_options, &cert_status); |
| 5743 |
| 5744 // Currently only works for Windows. When using NSS or OS X, it's not |
| 5745 // possible to determine whether the check failed because of actual |
| 5746 // revocation or because there was an OCSP failure. |
| 5747 #if defined(OS_WIN) |
| 5748 EXPECT_EQ(CERT_STATUS_REVOKED, cert_status & CERT_STATUS_ALL_ERRORS); |
| 5749 #else |
| 5750 EXPECT_EQ(0u, cert_status & CERT_STATUS_ALL_ERRORS); |
| 5751 #endif |
| 5752 |
| 5753 EXPECT_FALSE(cert_status & CERT_STATUS_IS_EV); |
| 5754 EXPECT_EQ(SystemUsesChromiumEVMetadata(), |
| 5755 static_cast<bool>(cert_status & CERT_STATUS_REV_CHECKING_ENABLED)); |
| 5756 } |
| 5757 |
5730 TEST_F(HTTPSEVCRLSetTest, MissingCRLSetAndGoodOCSP) { | 5758 TEST_F(HTTPSEVCRLSetTest, MissingCRLSetAndGoodOCSP) { |
5731 if (!SystemSupportsOCSP()) { | 5759 if (!SystemSupportsOCSP()) { |
5732 LOG(WARNING) << "Skipping test because system doesn't support OCSP"; | 5760 LOG(WARNING) << "Skipping test because system doesn't support OCSP"; |
5733 return; | 5761 return; |
5734 } | 5762 } |
5735 | 5763 |
5736 SpawnedTestServer::SSLOptions ssl_options( | 5764 SpawnedTestServer::SSLOptions ssl_options( |
5737 SpawnedTestServer::SSLOptions::CERT_AUTO); | 5765 SpawnedTestServer::SSLOptions::CERT_AUTO); |
5738 ssl_options.ocsp_status = SpawnedTestServer::SSLOptions::OCSP_OK; | 5766 ssl_options.ocsp_status = SpawnedTestServer::SSLOptions::OCSP_OK; |
5739 SSLConfigService::SetCRLSet(scoped_refptr<CRLSet>()); | 5767 SSLConfigService::SetCRLSet(scoped_refptr<CRLSet>()); |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6258 | 6286 |
6259 EXPECT_FALSE(r.is_pending()); | 6287 EXPECT_FALSE(r.is_pending()); |
6260 EXPECT_EQ(1, d->response_started_count()); | 6288 EXPECT_EQ(1, d->response_started_count()); |
6261 EXPECT_FALSE(d->received_data_before_response()); | 6289 EXPECT_FALSE(d->received_data_before_response()); |
6262 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); | 6290 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); |
6263 } | 6291 } |
6264 } | 6292 } |
6265 #endif // !defined(DISABLE_FTP_SUPPORT) | 6293 #endif // !defined(DISABLE_FTP_SUPPORT) |
6266 | 6294 |
6267 } // namespace net | 6295 } // namespace net |
OLD | NEW |