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 <memory> | 5 #include <memory> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
(...skipping 9356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9367 return; | 9367 return; |
9368 } | 9368 } |
9369 | 9369 |
9370 SpawnedTestServer::SSLOptions ssl_options( | 9370 SpawnedTestServer::SSLOptions ssl_options( |
9371 SpawnedTestServer::SSLOptions::CERT_AUTO); | 9371 SpawnedTestServer::SSLOptions::CERT_AUTO); |
9372 ssl_options.ocsp_status = SpawnedTestServer::SSLOptions::OCSP_REVOKED; | 9372 ssl_options.ocsp_status = SpawnedTestServer::SSLOptions::OCSP_REVOKED; |
9373 | 9373 |
9374 CertStatus cert_status; | 9374 CertStatus cert_status; |
9375 DoConnection(ssl_options, &cert_status); | 9375 DoConnection(ssl_options, &cert_status); |
9376 | 9376 |
9377 #if !(defined(OS_MACOSX) && !defined(OS_IOS)) | |
9378 // Doesn't pass on OS X yet for reasons that need to be investigated. | |
Ryan Sleevi
2016/08/12 19:50:17
I think this may start causing flaky failures, bec
mattm
2016/08/16 01:41:34
Isn't that a bigger problem then? Wouldn't this te
mattm
2016/08/16 02:14:30
If I'm reading the code correctly, it uses a rando
| |
9379 EXPECT_EQ(CERT_STATUS_REVOKED, cert_status & CERT_STATUS_ALL_ERRORS); | 9377 EXPECT_EQ(CERT_STATUS_REVOKED, cert_status & CERT_STATUS_ALL_ERRORS); |
9380 #endif | |
9381 EXPECT_FALSE(cert_status & CERT_STATUS_IS_EV); | 9378 EXPECT_FALSE(cert_status & CERT_STATUS_IS_EV); |
9382 EXPECT_TRUE(cert_status & CERT_STATUS_REV_CHECKING_ENABLED); | 9379 EXPECT_TRUE(cert_status & CERT_STATUS_REV_CHECKING_ENABLED); |
9383 } | 9380 } |
9384 | 9381 |
9385 TEST_F(HTTPSOCSPTest, Invalid) { | 9382 TEST_F(HTTPSOCSPTest, Invalid) { |
9386 if (!SystemSupportsOCSP()) { | 9383 if (!SystemSupportsOCSP()) { |
9387 LOG(WARNING) << "Skipping test because system doesn't support OCSP"; | 9384 LOG(WARNING) << "Skipping test because system doesn't support OCSP"; |
9388 return; | 9385 return; |
9389 } | 9386 } |
9390 | 9387 |
9391 SpawnedTestServer::SSLOptions ssl_options( | 9388 SpawnedTestServer::SSLOptions ssl_options( |
9392 SpawnedTestServer::SSLOptions::CERT_AUTO); | 9389 SpawnedTestServer::SSLOptions::CERT_AUTO); |
9393 ssl_options.ocsp_status = SpawnedTestServer::SSLOptions::OCSP_INVALID; | 9390 ssl_options.ocsp_status = SpawnedTestServer::SSLOptions::OCSP_INVALID; |
9394 | 9391 |
9395 CertStatus cert_status; | 9392 CertStatus cert_status; |
9396 DoConnection(ssl_options, &cert_status); | 9393 DoConnection(ssl_options, &cert_status); |
9397 | 9394 |
9395 #if defined(OS_MACOSX) && !defined(OS_IOS) | |
9396 // TODO(mattm): Figure out why CERT_STATUS_UNABLE_TO_CHECK_REVOCATION is | |
9397 // returned for this test but not any of the other ones that use | |
9398 // ExpectedCertStatusForFailedOnlineRevocationCheck. | |
9399 EXPECT_EQ(CERT_STATUS_UNABLE_TO_CHECK_REVOCATION, | |
9400 cert_status & CERT_STATUS_ALL_ERRORS); | |
9401 #else | |
9398 EXPECT_EQ(ExpectedCertStatusForFailedOnlineRevocationCheck(), | 9402 EXPECT_EQ(ExpectedCertStatusForFailedOnlineRevocationCheck(), |
Ryan Sleevi
2016/08/12 19:50:17
Looking at the definition of this, shouldn't you j
mattm
2016/08/16 01:41:34
Done. I had to fix HTTPSEVCRLSetTest.MissingCRLSet
| |
9399 cert_status & CERT_STATUS_ALL_ERRORS); | 9403 cert_status & CERT_STATUS_ALL_ERRORS); |
9404 #endif | |
9400 | 9405 |
9401 // Without a positive OCSP response, we shouldn't show the EV status. | 9406 // Without a positive OCSP response, we shouldn't show the EV status. |
9402 EXPECT_FALSE(cert_status & CERT_STATUS_IS_EV); | 9407 EXPECT_FALSE(cert_status & CERT_STATUS_IS_EV); |
9403 EXPECT_TRUE(cert_status & CERT_STATUS_REV_CHECKING_ENABLED); | 9408 EXPECT_TRUE(cert_status & CERT_STATUS_REV_CHECKING_ENABLED); |
9404 } | 9409 } |
9405 | 9410 |
9406 TEST_F(HTTPSOCSPTest, ValidStapled) { | 9411 TEST_F(HTTPSOCSPTest, ValidStapled) { |
9407 if (!SystemSupportsOCSPStapling()) { | 9412 if (!SystemSupportsOCSPStapling()) { |
9408 LOG(WARNING) | 9413 LOG(WARNING) |
9409 << "Skipping test because system doesn't support OCSP stapling"; | 9414 << "Skipping test because system doesn't support OCSP stapling"; |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10104 AddTestInterceptor()->set_main_intercept_job(std::move(job)); | 10109 AddTestInterceptor()->set_main_intercept_job(std::move(job)); |
10105 | 10110 |
10106 req->Start(); | 10111 req->Start(); |
10107 req->Cancel(); | 10112 req->Cancel(); |
10108 base::RunLoop().RunUntilIdle(); | 10113 base::RunLoop().RunUntilIdle(); |
10109 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status()); | 10114 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status()); |
10110 EXPECT_EQ(0, d.received_redirect_count()); | 10115 EXPECT_EQ(0, d.received_redirect_count()); |
10111 } | 10116 } |
10112 | 10117 |
10113 } // namespace net | 10118 } // namespace net |
OLD | NEW |