Chromium Code Reviews| 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/base/multi_threaded_cert_verifier.h" | 5 #include "net/base/multi_threaded_cert_verifier.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 verify_result->verified_cert = cert; | 42 verify_result->verified_cert = cert; |
| 43 verify_result->cert_status = CERT_STATUS_COMMON_NAME_INVALID; | 43 verify_result->cert_status = CERT_STATUS_COMMON_NAME_INVALID; |
| 44 return ERR_CERT_COMMON_NAME_INVALID; | 44 return ERR_CERT_COMMON_NAME_INVALID; |
| 45 } | 45 } |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 } // namespace | 48 } // namespace |
| 49 | 49 |
| 50 class MultiThreadedCertVerifierTest : public ::testing::Test { | 50 class MultiThreadedCertVerifierTest : public ::testing::Test { |
| 51 public: | 51 public: |
| 52 MultiThreadedCertVerifierTest() { | 52 MultiThreadedCertVerifierTest() : verifier_(new MockCertVerifyProc()) {} |
|
wtc
2012/09/18 02:51:55
This is good. The original code required us to cre
| |
| 53 verifier_.SetCertVerifyProc(new MockCertVerifyProc()); | |
| 54 } | |
| 55 virtual ~MultiThreadedCertVerifierTest() {} | 53 virtual ~MultiThreadedCertVerifierTest() {} |
| 56 | 54 |
| 57 protected: | 55 protected: |
| 58 MultiThreadedCertVerifier verifier_; | 56 MultiThreadedCertVerifier verifier_; |
| 59 }; | 57 }; |
| 60 | 58 |
| 61 TEST_F(MultiThreadedCertVerifierTest, CacheHit) { | 59 TEST_F(MultiThreadedCertVerifierTest, CacheHit) { |
| 62 FilePath certs_dir = GetTestCertsDirectory(); | 60 FilePath certs_dir = GetTestCertsDirectory(); |
| 63 scoped_refptr<X509Certificate> test_cert( | 61 scoped_refptr<X509Certificate> test_cert( |
| 64 ImportCertFromFile(certs_dir, "ok_cert.pem")); | 62 ImportCertFromFile(certs_dir, "ok_cert.pem")); |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 319 EXPECT_FALSE(key1 < key2); | 317 EXPECT_FALSE(key1 < key2); |
| 320 EXPECT_TRUE(key2 < key1); | 318 EXPECT_TRUE(key2 < key1); |
| 321 break; | 319 break; |
| 322 default: | 320 default: |
| 323 FAIL() << "Invalid expectation. Can be only -1, 0, 1"; | 321 FAIL() << "Invalid expectation. Can be only -1, 0, 1"; |
| 324 } | 322 } |
| 325 } | 323 } |
| 326 } | 324 } |
| 327 | 325 |
| 328 } // namespace net | 326 } // namespace net |
| OLD | NEW |