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

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

Issue 2800993002: Add a key purpose parameter to Certificate PathBuilder. (Closed)
Patch Set: rebase Created 3 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
« no previous file with comments | « net/cert/internal/test_helpers.h ('k') | net/cert/internal/trust_store.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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 std::move(root)); 167 std::move(root));
168 } else if (block_type == kTimeHeader) { 168 } else if (block_type == kTimeHeader) {
169 ASSERT_FALSE(has_time) << "Duplicate " << kTimeHeader; 169 ASSERT_FALSE(has_time) << "Duplicate " << kTimeHeader;
170 has_time = true; 170 has_time = true;
171 ASSERT_TRUE(der::ParseUTCTime(der::Input(&block_data), &test->time)); 171 ASSERT_TRUE(der::ParseUTCTime(der::Input(&block_data), &test->time));
172 } else if (block_type == kKeyPurpose) { 172 } else if (block_type == kKeyPurpose) {
173 ASSERT_FALSE(has_key_purpose) << "Duplicate " << kKeyPurpose; 173 ASSERT_FALSE(has_key_purpose) << "Duplicate " << kKeyPurpose;
174 has_key_purpose = true; 174 has_key_purpose = true;
175 175
176 if (block_data == "anyExtendedKeyUsage") { 176 if (block_data == "anyExtendedKeyUsage") {
177 // TODO(eroman): test->key_purpose = .... 177 test->key_purpose = KeyPurpose::ANY_EKU;
178 } else if (block_data == "serverAuth") { 178 } else if (block_data == "serverAuth") {
179 // TODO(eroman): test->key_purpose = .... 179 test->key_purpose = KeyPurpose::SERVER_AUTH;
180 } else if (block_data == "clientAuth") { 180 } else if (block_data == "clientAuth") {
181 // TODO(eroman): test->key_purpose = .... 181 test->key_purpose = KeyPurpose::CLIENT_AUTH;
182 } else { 182 } else {
183 ADD_FAILURE() << "Unrecognized " << block_type << ": " << block_data; 183 ADD_FAILURE() << "Unrecognized " << block_type << ": " << block_data;
184 } 184 }
185 } else if (block_type == kResultHeader) { 185 } else if (block_type == kResultHeader) {
186 ASSERT_FALSE(has_result) << "Duplicate " << kResultHeader; 186 ASSERT_FALSE(has_result) << "Duplicate " << kResultHeader;
187 ASSERT_TRUE(block_data == "SUCCESS" || block_data == "FAIL") 187 ASSERT_TRUE(block_data == "SUCCESS" || block_data == "FAIL")
188 << "Unrecognized result: " << block_data; 188 << "Unrecognized result: " << block_data;
189 has_result = true; 189 has_result = true;
190 test->expected_result = block_data == "SUCCESS"; 190 test->expected_result = block_data == "SUCCESS";
191 } else if (block_type == kErrorsHeader) { 191 } else if (block_type == kErrorsHeader) {
(...skipping 19 matching lines...) Expand all
211 std::string file_data; 211 std::string file_data;
212 if (!base::ReadFileToString(filepath, &file_data)) { 212 if (!base::ReadFileToString(filepath, &file_data)) {
213 ADD_FAILURE() << "Couldn't read file: " << filepath.value(); 213 ADD_FAILURE() << "Couldn't read file: " << filepath.value();
214 return std::string(); 214 return std::string();
215 } 215 }
216 216
217 return file_data; 217 return file_data;
218 } 218 }
219 219
220 } // namespace net 220 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/internal/test_helpers.h ('k') | net/cert/internal/trust_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698