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

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

Issue 1573243011: Refactor der::Input helper methods into new constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nits Created 4 years, 11 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.cc » ('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 14 matching lines...) Expand all
25 25
26 *os << "[" << b64 << "]"; 26 *os << "[" << b64 << "]";
27 } 27 }
28 28
29 bool operator==(const Input& a, const Input& b) { 29 bool operator==(const Input& a, const Input& b) {
30 return a.Equals(b); 30 return a.Equals(b);
31 } 31 }
32 32
33 } // namespace der 33 } // namespace der
34 34
35 der::Input InputFromString(const std::string* s) {
36 return der::Input(reinterpret_cast<const uint8_t*>(s->data()), s->size());
37 }
38
39 der::Input SequenceValueFromString(const std::string* s) { 35 der::Input SequenceValueFromString(const std::string* s) {
40 der::Parser parser(InputFromString(s)); 36 der::Parser parser((der::Input(s)));
41 der::Input data; 37 der::Input data;
42 if (!parser.ReadTag(der::kSequence, &data)) { 38 if (!parser.ReadTag(der::kSequence, &data)) {
43 ADD_FAILURE(); 39 ADD_FAILURE();
44 return der::Input(); 40 return der::Input();
45 } 41 }
46 if (parser.HasMore()) { 42 if (parser.HasMore()) {
47 ADD_FAILURE(); 43 ADD_FAILURE();
48 return der::Input(); 44 return der::Input();
49 } 45 }
50 return data; 46 return data;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 if (mapping.value && !mapping.optional) { 98 if (mapping.value && !mapping.optional) {
103 return ::testing::AssertionFailure() << "PEM block missing: " 99 return ::testing::AssertionFailure() << "PEM block missing: "
104 << mapping.block_name; 100 << mapping.block_name;
105 } 101 }
106 } 102 }
107 103
108 return ::testing::AssertionSuccess(); 104 return ::testing::AssertionSuccess();
109 } 105 }
110 106
111 } // namespace net 107 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/internal/test_helpers.h ('k') | net/cert/internal/verify_certificate_chain.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698