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

Side by Side Diff: net/cert/internal/test_helpers.cc

Issue 2903283002: Add policies support to VerifyCertificateChain(). (Closed)
Patch Set: improve comments, and null policy tree when anyPolicy is incorrectly mapped 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/internal/test_helpers.h ('k') | net/cert/internal/verify_certificate_chain.h » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/internal/test_helpers.h" 5 #include "net/cert/internal/test_helpers.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/base_paths.h" 8 #include "base/base_paths.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 for (const auto& mapping : mappings_copy) { 118 for (const auto& mapping : mappings_copy) {
119 if (mapping.value && !mapping.optional) { 119 if (mapping.value && !mapping.optional) {
120 return ::testing::AssertionFailure() 120 return ::testing::AssertionFailure()
121 << "PEM block missing: " << mapping.block_name; 121 << "PEM block missing: " << mapping.block_name;
122 } 122 }
123 } 123 }
124 124
125 return ::testing::AssertionSuccess(); 125 return ::testing::AssertionSuccess();
126 } 126 }
127 127
128 VerifyCertChainTest::VerifyCertChainTest() = default; 128 VerifyCertChainTest::VerifyCertChainTest()
129 : user_initial_policy_set{AnyPolicy()} {}
129 VerifyCertChainTest::~VerifyCertChainTest() = default; 130 VerifyCertChainTest::~VerifyCertChainTest() = default;
130 131
131 bool VerifyCertChainTest::HasHighSeverityErrors() const { 132 bool VerifyCertChainTest::HasHighSeverityErrors() const {
132 // This function assumes that high severity warnings are prefixed with 133 // This function assumes that high severity warnings are prefixed with
133 // "ERROR: " and warnings are prefixed with "WARNING: ". This is an 134 // "ERROR: " and warnings are prefixed with "WARNING: ". This is an
134 // implementation detail of CertError::ToDebugString). 135 // implementation detail of CertError::ToDebugString).
135 // 136 //
136 // Do a quick sanity-check to confirm this. 137 // Do a quick sanity-check to confirm this.
137 CertError error(CertError::SEVERITY_HIGH, "unused", nullptr); 138 CertError error(CertError::SEVERITY_HIGH, "unused", nullptr);
138 EXPECT_EQ("ERROR: unused\n", error.ToDebugString()); 139 EXPECT_EQ("ERROR: unused\n", error.ToDebugString());
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 std::string file_data; 302 std::string file_data;
302 if (!base::ReadFileToString(filepath, &file_data)) { 303 if (!base::ReadFileToString(filepath, &file_data)) {
303 ADD_FAILURE() << "Couldn't read file: " << filepath.value(); 304 ADD_FAILURE() << "Couldn't read file: " << filepath.value();
304 return std::string(); 305 return std::string();
305 } 306 }
306 307
307 return file_data; 308 return file_data;
308 } 309 }
309 310
310 } // namespace net 311 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/internal/test_helpers.h ('k') | net/cert/internal/verify_certificate_chain.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698