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

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

Issue 2870323002: Add parsing for RFC 5280's InhibitAnyPolicy. (Closed)
Patch Set: fix comment Created 3 years, 7 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/parsed_certificate.h" 5 #include "net/cert/internal/parsed_certificate.h"
6 6
7 #include "net/cert/internal/cert_errors.h" 7 #include "net/cert/internal/cert_errors.h"
8 #include "net/cert/internal/parse_certificate.h" 8 #include "net/cert/internal/parse_certificate.h"
9 #include "net/cert/internal/test_helpers.h" 9 #include "net/cert/internal/test_helpers.h"
10 #include "net/der/input.h" 10 #include "net/der/input.h"
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 } 349 }
350 350
351 // Tests parsing a certificate that has a policyConstraints 351 // Tests parsing a certificate that has a policyConstraints
352 // extension with an empty sequence. 352 // extension with an empty sequence.
353 TEST(ParsedCertificateTest, PolicyConstraintsEmpty) { 353 TEST(ParsedCertificateTest, PolicyConstraintsEmpty) {
354 scoped_refptr<ParsedCertificate> cert = 354 scoped_refptr<ParsedCertificate> cert =
355 ParseCertificateFromFile("policy_constraints_empty.pem"); 355 ParseCertificateFromFile("policy_constraints_empty.pem");
356 ASSERT_FALSE(cert); 356 ASSERT_FALSE(cert);
357 } 357 }
358 358
359 // Tests parsing a certificate that has an inhibitAnyPolicy extension.
360 TEST(ParsedCertificateTest, InhibitAnyPolicy) {
361 scoped_refptr<ParsedCertificate> cert =
362 ParseCertificateFromFile("inhibit_any_policy.pem");
363 ASSERT_TRUE(cert);
364
365 ParsedExtension extension;
366 ASSERT_TRUE(cert->GetExtension(InhibitAnyPolicyOid(), &extension));
367
368 uint8_t skip_count;
369 ASSERT_TRUE(ParseInhibitAnyPolicy(extension.value, &skip_count));
370 EXPECT_EQ(3, skip_count);
371 }
372
359 } // namespace 373 } // namespace
360 374
361 } // namespace net 375 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698