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

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: delete scoped_ptr and use unique_ptr Created 4 years, 7 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 <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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698