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 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1593 TEST_F(HTTPSOCSPTest, Invalid) { | 1593 TEST_F(HTTPSOCSPTest, Invalid) { |
1594 if (!SystemSupportsOCSP()) { | 1594 if (!SystemSupportsOCSP()) { |
1595 LOG(WARNING) << "Skipping test because system doesn't support OCSP"; | 1595 LOG(WARNING) << "Skipping test because system doesn't support OCSP"; |
1596 return; | 1596 return; |
1597 } | 1597 } |
1598 | 1598 |
1599 TestServer::HTTPSOptions https_options( | 1599 TestServer::HTTPSOptions https_options( |
1600 TestServer::HTTPSOptions::CERT_AUTO); | 1600 TestServer::HTTPSOptions::CERT_AUTO); |
1601 https_options.ocsp_status = TestServer::HTTPSOptions::OCSP_INVALID; | 1601 https_options.ocsp_status = TestServer::HTTPSOptions::OCSP_INVALID; |
1602 | 1602 |
1603 CertStatus cert_status; | 1603 CertStatus cert_status = 0; |
1604 DoConnection(https_options, &cert_status); | 1604 DoConnection(https_options, &cert_status); |
1605 | 1605 |
1606 EXPECT_EQ(ExpectedCertStatusForFailedOnlineRevocationCheck(), | 1606 EXPECT_EQ(ExpectedCertStatusForFailedOnlineRevocationCheck(), |
1607 cert_status & CERT_STATUS_ALL_ERRORS); | 1607 cert_status & CERT_STATUS_ALL_ERRORS); |
1608 | 1608 |
1609 // Without a positive OCSP response, we shouldn't show the EV status. | 1609 // Without a positive OCSP response, we shouldn't show the EV status. |
1610 EXPECT_FALSE(cert_status & CERT_STATUS_IS_EV); | 1610 EXPECT_FALSE(cert_status & CERT_STATUS_IS_EV); |
1611 EXPECT_TRUE(cert_status & CERT_STATUS_REV_CHECKING_ENABLED); | 1611 EXPECT_TRUE(cert_status & CERT_STATUS_REV_CHECKING_ENABLED); |
1612 } | 1612 } |
1613 | 1613 |
(...skipping 10 matching lines...) Expand all Loading... |
1624 if (!SystemSupportsOCSP()) { | 1624 if (!SystemSupportsOCSP()) { |
1625 LOG(WARNING) << "Skipping test because system doesn't support OCSP"; | 1625 LOG(WARNING) << "Skipping test because system doesn't support OCSP"; |
1626 return; | 1626 return; |
1627 } | 1627 } |
1628 | 1628 |
1629 TestServer::HTTPSOptions https_options( | 1629 TestServer::HTTPSOptions https_options( |
1630 TestServer::HTTPSOptions::CERT_AUTO); | 1630 TestServer::HTTPSOptions::CERT_AUTO); |
1631 https_options.ocsp_status = TestServer::HTTPSOptions::OCSP_INVALID; | 1631 https_options.ocsp_status = TestServer::HTTPSOptions::OCSP_INVALID; |
1632 SSLConfigService::SetCRLSet(scoped_refptr<CRLSet>()); | 1632 SSLConfigService::SetCRLSet(scoped_refptr<CRLSet>()); |
1633 | 1633 |
1634 CertStatus cert_status; | 1634 CertStatus cert_status = 0; |
1635 DoConnection(https_options, &cert_status); | 1635 DoConnection(https_options, &cert_status); |
1636 | 1636 |
1637 EXPECT_EQ(ExpectedCertStatusForFailedOnlineRevocationCheck(), | 1637 EXPECT_EQ(ExpectedCertStatusForFailedOnlineRevocationCheck(), |
1638 cert_status & CERT_STATUS_ALL_ERRORS); | 1638 cert_status & CERT_STATUS_ALL_ERRORS); |
1639 | 1639 |
1640 EXPECT_FALSE(cert_status & CERT_STATUS_IS_EV); | 1640 EXPECT_FALSE(cert_status & CERT_STATUS_IS_EV); |
1641 EXPECT_TRUE(cert_status & CERT_STATUS_REV_CHECKING_ENABLED); | 1641 EXPECT_TRUE(cert_status & CERT_STATUS_REV_CHECKING_ENABLED); |
1642 } | 1642 } |
1643 | 1643 |
1644 TEST_F(HTTPSEVCRLSetTest, MissingCRLSetAndGoodOCSP) { | 1644 TEST_F(HTTPSEVCRLSetTest, MissingCRLSetAndGoodOCSP) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1685 EXPECT_TRUE(cert_status & CERT_STATUS_REV_CHECKING_ENABLED); | 1685 EXPECT_TRUE(cert_status & CERT_STATUS_REV_CHECKING_ENABLED); |
1686 } | 1686 } |
1687 | 1687 |
1688 TEST_F(HTTPSEVCRLSetTest, FreshCRLSet) { | 1688 TEST_F(HTTPSEVCRLSetTest, FreshCRLSet) { |
1689 TestServer::HTTPSOptions https_options( | 1689 TestServer::HTTPSOptions https_options( |
1690 TestServer::HTTPSOptions::CERT_AUTO); | 1690 TestServer::HTTPSOptions::CERT_AUTO); |
1691 https_options.ocsp_status = TestServer::HTTPSOptions::OCSP_INVALID; | 1691 https_options.ocsp_status = TestServer::HTTPSOptions::OCSP_INVALID; |
1692 SSLConfigService::SetCRLSet( | 1692 SSLConfigService::SetCRLSet( |
1693 scoped_refptr<CRLSet>(CRLSet::EmptyCRLSetForTesting())); | 1693 scoped_refptr<CRLSet>(CRLSet::EmptyCRLSetForTesting())); |
1694 | 1694 |
1695 CertStatus cert_status; | 1695 CertStatus cert_status = 0; |
1696 DoConnection(https_options, &cert_status); | 1696 DoConnection(https_options, &cert_status); |
1697 | 1697 |
1698 // With a valid, fresh CRLSet the bad OCSP response shouldn't matter because | 1698 // With a valid, fresh CRLSet the bad OCSP response shouldn't matter because |
1699 // we wont check it. | 1699 // we wont check it. |
1700 EXPECT_EQ(0u, cert_status & CERT_STATUS_ALL_ERRORS); | 1700 EXPECT_EQ(0u, cert_status & CERT_STATUS_ALL_ERRORS); |
1701 | 1701 |
1702 EXPECT_EQ(SystemUsesChromiumEVMetadata(), | 1702 EXPECT_EQ(SystemUsesChromiumEVMetadata(), |
1703 static_cast<bool>(cert_status & CERT_STATUS_IS_EV)); | 1703 static_cast<bool>(cert_status & CERT_STATUS_IS_EV)); |
1704 | 1704 |
1705 EXPECT_FALSE(cert_status & CERT_STATUS_REV_CHECKING_ENABLED); | 1705 EXPECT_FALSE(cert_status & CERT_STATUS_REV_CHECKING_ENABLED); |
1706 } | 1706 } |
1707 | 1707 |
1708 class HTTPSCRLSetTest : public HTTPSOCSPTest { | 1708 class HTTPSCRLSetTest : public HTTPSOCSPTest { |
1709 protected: | 1709 protected: |
1710 virtual void SetupContext(URLRequestContext* context) OVERRIDE { | 1710 virtual void SetupContext(URLRequestContext* context) OVERRIDE { |
1711 context->set_ssl_config_service( | 1711 context->set_ssl_config_service( |
1712 new TestSSLConfigService(false /* check for EV */, | 1712 new TestSSLConfigService(false /* check for EV */, |
1713 false /* online revocation checking */)); | 1713 false /* online revocation checking */)); |
1714 } | 1714 } |
1715 }; | 1715 }; |
1716 | 1716 |
1717 TEST_F(HTTPSCRLSetTest, ExpiredCRLSet) { | 1717 TEST_F(HTTPSCRLSetTest, ExpiredCRLSet) { |
1718 TestServer::HTTPSOptions https_options( | 1718 TestServer::HTTPSOptions https_options( |
1719 TestServer::HTTPSOptions::CERT_AUTO); | 1719 TestServer::HTTPSOptions::CERT_AUTO); |
1720 https_options.ocsp_status = TestServer::HTTPSOptions::OCSP_INVALID; | 1720 https_options.ocsp_status = TestServer::HTTPSOptions::OCSP_INVALID; |
1721 SSLConfigService::SetCRLSet( | 1721 SSLConfigService::SetCRLSet( |
1722 scoped_refptr<CRLSet>(CRLSet::ExpiredCRLSetForTesting())); | 1722 scoped_refptr<CRLSet>(CRLSet::ExpiredCRLSetForTesting())); |
1723 | 1723 |
1724 CertStatus cert_status; | 1724 CertStatus cert_status = 0; |
1725 DoConnection(https_options, &cert_status); | 1725 DoConnection(https_options, &cert_status); |
1726 | 1726 |
1727 // If we're not trying EV verification then, even if the CRLSet has expired, | 1727 // If we're not trying EV verification then, even if the CRLSet has expired, |
1728 // we don't fall back to online revocation checks. | 1728 // we don't fall back to online revocation checks. |
1729 EXPECT_EQ(0u, cert_status & CERT_STATUS_ALL_ERRORS); | 1729 EXPECT_EQ(0u, cert_status & CERT_STATUS_ALL_ERRORS); |
1730 EXPECT_FALSE(cert_status & CERT_STATUS_IS_EV); | 1730 EXPECT_FALSE(cert_status & CERT_STATUS_IS_EV); |
1731 EXPECT_FALSE(cert_status & CERT_STATUS_REV_CHECKING_ENABLED); | 1731 EXPECT_FALSE(cert_status & CERT_STATUS_REV_CHECKING_ENABLED); |
1732 } | 1732 } |
1733 | 1733 |
1734 TEST_F(HTTPSRequestTest, SSLv3Fallback) { | 1734 TEST_F(HTTPSRequestTest, SSLv3Fallback) { |
(...skipping 2859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4594 req.SetExtraRequestHeaders(headers); | 4594 req.SetExtraRequestHeaders(headers); |
4595 req.Start(); | 4595 req.Start(); |
4596 MessageLoop::current()->Run(); | 4596 MessageLoop::current()->Run(); |
4597 // If the net tests are being run with ChromeFrame then we need to allow for | 4597 // If the net tests are being run with ChromeFrame then we need to allow for |
4598 // the 'chromeframe' suffix which is added to the user agent before the | 4598 // the 'chromeframe' suffix which is added to the user agent before the |
4599 // closing parentheses. | 4599 // closing parentheses. |
4600 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true)); | 4600 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true)); |
4601 } | 4601 } |
4602 | 4602 |
4603 } // namespace net | 4603 } // namespace net |
OLD | NEW |