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

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

Issue 2100303002: Add OCSPVerifyResult for tracking stapled OCSP responses cross-platform. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ocsp-date-check
Patch Set: Remaining nits. Created 4 years, 5 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/parse_ocsp.cc ('k') | net/cert/ocsp_revocation_status.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/parse_ocsp.h" 5 #include "net/cert/internal/parse_ocsp.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "net/cert/internal/test_helpers.h" 9 #include "net/cert/internal/test_helpers.h"
10 #include "net/cert/x509_certificate.h" 10 #include "net/cert/x509_certificate.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 if (!ParseOCSPResponseData(parsed_ocsp.data, &parsed_ocsp_data)) 73 if (!ParseOCSPResponseData(parsed_ocsp.data, &parsed_ocsp_data))
74 return PARSE_OCSP_DATA; 74 return PARSE_OCSP_DATA;
75 75
76 OCSPCertStatus status; 76 OCSPCertStatus status;
77 77
78 if (!GetOCSPCertStatus(parsed_ocsp_data, issuer_tbs_certificate_tlv, 78 if (!GetOCSPCertStatus(parsed_ocsp_data, issuer_tbs_certificate_tlv,
79 cert_tbs_certificate_tlv, &status)) 79 cert_tbs_certificate_tlv, &status))
80 return PARSE_OCSP_SINGLE_RESPONSE; 80 return PARSE_OCSP_SINGLE_RESPONSE;
81 81
82 switch (status.status) { 82 switch (status.status) {
83 case OCSPCertStatus::Status::GOOD: 83 case OCSPRevocationStatus::GOOD:
84 return OCSP_SUCCESS; 84 return OCSP_SUCCESS;
85 case OCSPCertStatus::Status::REVOKED: 85 case OCSPRevocationStatus::REVOKED:
86 return OCSP_SUCCESS_REVOKED; 86 return OCSP_SUCCESS_REVOKED;
87 case OCSPCertStatus::Status::UNKNOWN: 87 case OCSPRevocationStatus::UNKNOWN:
88 return OCSP_SUCCESS_UNKNOWN; 88 return OCSP_SUCCESS_UNKNOWN;
89 } 89 }
90 90
91 return OCSP_SUCCESS_UNKNOWN; 91 return OCSP_SUCCESS_UNKNOWN;
92 } 92 }
93 93
94 } // namespace 94 } // namespace
95 95
96 TEST(ParseOCSPTest, OCSPGoodResponse) { 96 TEST(ParseOCSPTest, OCSPGoodResponse) {
97 ASSERT_EQ(OCSP_SUCCESS, ParseOCSP("good_response.pem")); 97 ASSERT_EQ(OCSP_SUCCESS, ParseOCSP("good_response.pem"));
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 der::EncodeTimeAsGeneralizedTime(this_update, &response.this_update)); 306 der::EncodeTimeAsGeneralizedTime(this_update, &response.this_update));
307 response.has_next_update = false; 307 response.has_next_update = false;
308 #if defined(OS_WIN) 308 #if defined(OS_WIN)
309 EXPECT_FALSE(CheckOCSPDateValid(response, verify_time, kOCSPAgeOneWeek)); 309 EXPECT_FALSE(CheckOCSPDateValid(response, verify_time, kOCSPAgeOneWeek));
310 #else 310 #else
311 EXPECT_TRUE(CheckOCSPDateValid(response, verify_time, kOCSPAgeOneWeek)); 311 EXPECT_TRUE(CheckOCSPDateValid(response, verify_time, kOCSPAgeOneWeek));
312 #endif 312 #endif
313 } 313 }
314 314
315 } // namespace net 315 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/internal/parse_ocsp.cc ('k') | net/cert/ocsp_revocation_status.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698