Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: net/cert/multi_threaded_cert_verifier_unittest.cc

Issue 1892033002: Cert - protobufs to serialize and deserialize CertVerifierCache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/debug/leak_annotations.h" 8 #include "base/debug/leak_annotations.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 NULL, &verify_result, callback.callback(), &request, 103 NULL, &verify_result, callback.callback(), &request,
104 BoundNetLog()); 104 BoundNetLog());
105 // Synchronous completion. 105 // Synchronous completion.
106 ASSERT_NE(ERR_IO_PENDING, error); 106 ASSERT_NE(ERR_IO_PENDING, error);
107 ASSERT_TRUE(IsCertificateError(error)); 107 ASSERT_TRUE(IsCertificateError(error));
108 ASSERT_FALSE(request); 108 ASSERT_FALSE(request);
109 ASSERT_EQ(2u, verifier_.requests()); 109 ASSERT_EQ(2u, verifier_.requests());
110 ASSERT_EQ(1u, verifier_.cache_hits()); 110 ASSERT_EQ(1u, verifier_.cache_hits());
111 ASSERT_EQ(0u, verifier_.inflight_joins()); 111 ASSERT_EQ(0u, verifier_.inflight_joins());
112 ASSERT_EQ(1u, verifier_.GetCacheSize()); 112 ASSERT_EQ(1u, verifier_.GetCacheSize());
113 MultiThreadedCertVerifier::CertVerifierCacheIterator iterator(verifier_);
114 EXPECT_TRUE(iterator.HasNext());
115 ASSERT_EQ("www.example.com", iterator.hostname());
116 iterator.Advance();
117 EXPECT_FALSE(iterator.HasNext());
113 } 118 }
114 119
115 // Tests the same server certificate with different intermediate CA 120 // Tests the same server certificate with different intermediate CA
116 // certificates. These should be treated as different certificate chains even 121 // certificates. These should be treated as different certificate chains even
117 // though the two X509Certificate objects contain the same server certificate. 122 // though the two X509Certificate objects contain the same server certificate.
118 TEST_F(MultiThreadedCertVerifierTest, DifferentCACerts) { 123 TEST_F(MultiThreadedCertVerifierTest, DifferentCACerts) {
119 base::FilePath certs_dir = GetTestCertsDirectory(); 124 base::FilePath certs_dir = GetTestCertsDirectory();
120 125
121 scoped_refptr<X509Certificate> server_cert = 126 scoped_refptr<X509Certificate> server_cert =
122 ImportCertFromFile(certs_dir, "salesforce_com_test.pem"); 127 ImportCertFromFile(certs_dir, "salesforce_com_test.pem");
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 error = callback4.WaitForResult(); 511 error = callback4.WaitForResult();
507 ASSERT_TRUE(IsCertificateError(error)); 512 ASSERT_TRUE(IsCertificateError(error));
508 513
509 // Let the other requests automatically cancel. 514 // Let the other requests automatically cancel.
510 ASSERT_EQ(5u, verifier_.requests()); 515 ASSERT_EQ(5u, verifier_.requests());
511 ASSERT_EQ(0u, verifier_.cache_hits()); 516 ASSERT_EQ(0u, verifier_.cache_hits());
512 ASSERT_EQ(2u, verifier_.inflight_joins()); 517 ASSERT_EQ(2u, verifier_.inflight_joins());
513 } 518 }
514 519
515 } // namespace net 520 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698