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 "net/cert/multi_threaded_cert_verifier.h" | 5 #include "net/cert/multi_threaded_cert_verifier.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 virtual ~MockCertTrustAnchorProvider() {} | 60 virtual ~MockCertTrustAnchorProvider() {} |
61 | 61 |
62 MOCK_METHOD0(GetAdditionalTrustAnchors, const CertificateList&()); | 62 MOCK_METHOD0(GetAdditionalTrustAnchors, const CertificateList&()); |
63 }; | 63 }; |
64 | 64 |
65 } // namespace | 65 } // namespace |
66 | 66 |
67 class MultiThreadedCertVerifierTest : public ::testing::Test { | 67 class MultiThreadedCertVerifierTest : public ::testing::Test { |
68 public: | 68 public: |
69 MultiThreadedCertVerifierTest() : verifier_(new MockCertVerifyProc()) {} | 69 MultiThreadedCertVerifierTest() : verifier_(new MockCertVerifyProc()) {} |
70 virtual ~MultiThreadedCertVerifierTest() {} | 70 ~MultiThreadedCertVerifierTest() override {} |
71 | 71 |
72 protected: | 72 protected: |
73 MultiThreadedCertVerifier verifier_; | 73 MultiThreadedCertVerifier verifier_; |
74 }; | 74 }; |
75 | 75 |
76 TEST_F(MultiThreadedCertVerifierTest, CacheHit) { | 76 TEST_F(MultiThreadedCertVerifierTest, CacheHit) { |
77 base::FilePath certs_dir = GetTestCertsDirectory(); | 77 base::FilePath certs_dir = GetTestCertsDirectory(); |
78 scoped_refptr<X509Certificate> test_cert( | 78 scoped_refptr<X509Certificate> test_cert( |
79 ImportCertFromFile(certs_dir, "ok_cert.pem")); | 79 ImportCertFromFile(certs_dir, "ok_cert.pem")); |
80 ASSERT_NE(static_cast<X509Certificate*>(NULL), test_cert.get()); | 80 ASSERT_NE(static_cast<X509Certificate*>(NULL), test_cert.get()); |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 Mock::VerifyAndClearExpectations(&trust_provider); | 474 Mock::VerifyAndClearExpectations(&trust_provider); |
475 ASSERT_EQ(ERR_IO_PENDING, error); | 475 ASSERT_EQ(ERR_IO_PENDING, error); |
476 EXPECT_TRUE(request_handle); | 476 EXPECT_TRUE(request_handle); |
477 error = callback.WaitForResult(); | 477 error = callback.WaitForResult(); |
478 EXPECT_EQ(ERR_CERT_COMMON_NAME_INVALID, error); | 478 EXPECT_EQ(ERR_CERT_COMMON_NAME_INVALID, error); |
479 ASSERT_EQ(3u, verifier_.requests()); | 479 ASSERT_EQ(3u, verifier_.requests()); |
480 ASSERT_EQ(1u, verifier_.cache_hits()); | 480 ASSERT_EQ(1u, verifier_.cache_hits()); |
481 } | 481 } |
482 | 482 |
483 } // namespace net | 483 } // namespace net |
OLD | NEW |