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

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

Issue 2926463002: Fix TransportSecurityState unittests to run in --single-process mode. (Closed)
Patch Set: Fixup model tests Created 3 years, 6 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
« no previous file with comments | « net/cert/cert_verify_proc.cc ('k') | net/data/ssl/certificates/10_year_validity.pem » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/cert_verify_proc.h" 5 #include "net/cert/cert_verify_proc.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 // There are 2 hashes each of the 3 certificates in the verified chain. 1229 // There are 2 hashes each of the 3 certificates in the verified chain.
1230 EXPECT_EQ(6u, verify_result.public_key_hashes.size()); 1230 EXPECT_EQ(6u, verify_result.public_key_hashes.size());
1231 1231
1232 // Convert |public_key_hashes| to strings for ease of comparison. 1232 // Convert |public_key_hashes| to strings for ease of comparison.
1233 std::vector<std::string> public_key_hash_strings; 1233 std::vector<std::string> public_key_hash_strings;
1234 for (const auto& public_key_hash : verify_result.public_key_hashes) 1234 for (const auto& public_key_hash : verify_result.public_key_hashes)
1235 public_key_hash_strings.push_back(public_key_hash.ToString()); 1235 public_key_hash_strings.push_back(public_key_hash.ToString());
1236 1236
1237 std::vector<std::string> expected_public_key_hashes = { 1237 std::vector<std::string> expected_public_key_hashes = {
1238 // Target 1238 // Target
1239 "sha1/fSQl8GTgpmark/9mDK9qzIIGfFE=", 1239 "sha1/eykCtxdjf+9TcP+dle4RZOcuWfI=",
1240 "sha256/5I5+4ndAhwDiWd1WqfBgDkKAAIEhsq0MfAx25Hoc+dA=", 1240 "sha256/jpsUnwFFTO7e+l5zQDYhutkf7uA+dCVsWfRvv0UDX40=",
1241 1241
1242 // Intermediate 1242 // Intermediate
1243 "sha1/7+0Ms07hEkAc6zVPOo+uLtMEwfU=", 1243 "sha1/UCuWOTyNcmLrd/Ie2jTjCHyGV7M=",
1244 "sha256/MtnqgdSwAIgEjse7SpxnmyKoo/RTiL9CDIWwFnz4nas=", 1244 "sha256/D9u0epgvPYlG9YiVp7V+IMT+xhUpB5BhsS/INjDXc4Y=",
1245 1245
1246 // Trust anchor 1246 // Trust anchor
1247 "sha1/dJwvO4gEVIZvretArGyBNggjlrQ=", 1247 "sha1/7lRAdhiny84OU7rosLno5A+v0ls=",
1248 "sha256/z7x1Szes+eQOqJp6rBK3u/tQMs55FYojZHUCFiBcjuc="}; 1248 "sha256/VypP3VWL7OaqTJ7mIBehWYlv8khPuFHpWiearZI2YjI="};
1249 1249
1250 // |public_key_hashes| does not have an ordering guarantee. 1250 // |public_key_hashes| does not have an ordering guarantee.
1251 EXPECT_THAT(expected_public_key_hashes, 1251 EXPECT_THAT(expected_public_key_hashes,
1252 testing::UnorderedElementsAreArray(public_key_hash_strings)); 1252 testing::UnorderedElementsAreArray(public_key_hash_strings));
1253 } 1253 }
1254 1254
1255 // A regression test for http://crbug.com/70293. 1255 // A regression test for http://crbug.com/70293.
1256 // The certificate in question has a key purpose of clientAuth, and also lacks 1256 // The certificate in question has a key purpose of clientAuth, and also lacks
1257 // the required key usage for serverAuth. 1257 // the required key usage for serverAuth.
1258 TEST_P(CertVerifyProcInternalTest, WrongKeyPurpose) { 1258 TEST_P(CertVerifyProcInternalTest, WrongKeyPurpose) {
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after
2438 int flags = 0; 2438 int flags = 0;
2439 CertVerifyResult verify_result; 2439 CertVerifyResult verify_result;
2440 int error = verify_proc->Verify(cert.get(), "127.0.0.1", std::string(), flags, 2440 int error = verify_proc->Verify(cert.get(), "127.0.0.1", std::string(), flags,
2441 NULL, CertificateList(), &verify_result); 2441 NULL, CertificateList(), &verify_result);
2442 EXPECT_EQ(OK, error); 2442 EXPECT_EQ(OK, error);
2443 histograms.ExpectTotalCount(kTLSFeatureExtensionHistogram, 0); 2443 histograms.ExpectTotalCount(kTLSFeatureExtensionHistogram, 0);
2444 histograms.ExpectTotalCount(kTLSFeatureExtensionOCSPHistogram, 0); 2444 histograms.ExpectTotalCount(kTLSFeatureExtensionOCSPHistogram, 0);
2445 } 2445 }
2446 2446
2447 } // namespace net 2447 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/cert_verify_proc.cc ('k') | net/data/ssl/certificates/10_year_validity.pem » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698