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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/debug/leak_annotations.h" | 10 #include "base/debug/leak_annotations.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 NULL, &verify_result, callback.callback(), &request, | 105 NULL, &verify_result, callback.callback(), &request, |
106 BoundNetLog()); | 106 BoundNetLog()); |
107 // Synchronous completion. | 107 // Synchronous completion. |
108 ASSERT_NE(ERR_IO_PENDING, error); | 108 ASSERT_NE(ERR_IO_PENDING, error); |
109 ASSERT_TRUE(IsCertificateError(error)); | 109 ASSERT_TRUE(IsCertificateError(error)); |
110 ASSERT_FALSE(request); | 110 ASSERT_FALSE(request); |
111 ASSERT_EQ(2u, verifier_.requests()); | 111 ASSERT_EQ(2u, verifier_.requests()); |
112 ASSERT_EQ(1u, verifier_.cache_hits()); | 112 ASSERT_EQ(1u, verifier_.cache_hits()); |
113 ASSERT_EQ(0u, verifier_.inflight_joins()); | 113 ASSERT_EQ(0u, verifier_.inflight_joins()); |
114 ASSERT_EQ(1u, verifier_.GetCacheSize()); | 114 ASSERT_EQ(1u, verifier_.GetCacheSize()); |
115 CertVerifierCacheIterator iterator(verifier_); | |
116 EXPECT_TRUE(iterator.HasNext()); | |
117 ASSERT_EQ("www.example.com", iterator.hostname()); | |
118 iterator.Advance(); | |
119 EXPECT_FALSE(iterator.HasNext()); | |
Ryan Sleevi
2016/04/29 23:33:21
No. Please add a new test.
ramant (doing other things)
2016/04/30 22:58:11
Done.
| |
115 } | 120 } |
116 | 121 |
117 // Tests the same server certificate with different intermediate CA | 122 // Tests the same server certificate with different intermediate CA |
118 // certificates. These should be treated as different certificate chains even | 123 // certificates. These should be treated as different certificate chains even |
119 // though the two X509Certificate objects contain the same server certificate. | 124 // though the two X509Certificate objects contain the same server certificate. |
120 TEST_F(MultiThreadedCertVerifierTest, DifferentCACerts) { | 125 TEST_F(MultiThreadedCertVerifierTest, DifferentCACerts) { |
121 base::FilePath certs_dir = GetTestCertsDirectory(); | 126 base::FilePath certs_dir = GetTestCertsDirectory(); |
122 | 127 |
123 scoped_refptr<X509Certificate> server_cert = | 128 scoped_refptr<X509Certificate> server_cert = |
124 ImportCertFromFile(certs_dir, "salesforce_com_test.pem"); | 129 ImportCertFromFile(certs_dir, "salesforce_com_test.pem"); |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
508 error = callback4.WaitForResult(); | 513 error = callback4.WaitForResult(); |
509 ASSERT_TRUE(IsCertificateError(error)); | 514 ASSERT_TRUE(IsCertificateError(error)); |
510 | 515 |
511 // Let the other requests automatically cancel. | 516 // Let the other requests automatically cancel. |
512 ASSERT_EQ(5u, verifier_.requests()); | 517 ASSERT_EQ(5u, verifier_.requests()); |
513 ASSERT_EQ(0u, verifier_.cache_hits()); | 518 ASSERT_EQ(0u, verifier_.cache_hits()); |
514 ASSERT_EQ(2u, verifier_.inflight_joins()); | 519 ASSERT_EQ(2u, verifier_.inflight_joins()); |
515 } | 520 } |
516 | 521 |
517 } // namespace net | 522 } // namespace net |
OLD | NEW |