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

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

Issue 2801813004: Refactor VerifyCertificateChain test data to include a key purpose (Closed)
Patch Set: checkpoint 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 | « no previous file | net/cert/internal/path_builder_verify_certificate_chain_unittest.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 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/path_builder.h" 5 #include "net/cert/internal/path_builder.h"
6 6
7 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "net/cert/internal/cert_issuer_source_static.h" 10 #include "net/cert/internal/cert_issuer_source_static.h"
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 EXPECT_EQ(d_by_d_, path.trust_anchor->cert()); 432 EXPECT_EQ(d_by_d_, path.trust_anchor->cert());
433 } 433 }
434 } 434 }
435 435
436 class PathBuilderKeyRolloverTest : public ::testing::Test { 436 class PathBuilderKeyRolloverTest : public ::testing::Test {
437 public: 437 public:
438 PathBuilderKeyRolloverTest() : signature_policy_(1024) {} 438 PathBuilderKeyRolloverTest() : signature_policy_(1024) {}
439 439
440 void SetUp() override { 440 void SetUp() override {
441 ParsedCertificateList path; 441 ParsedCertificateList path;
442 bool unused_result;
443 std::string unused_errors;
444 442
443 VerifyCertChainTest test;
445 ReadVerifyCertChainTestFromFile( 444 ReadVerifyCertChainTestFromFile(
446 "net/data/verify_certificate_chain_unittest/key-rollover-oldchain.pem", 445 "net/data/verify_certificate_chain_unittest/key-rollover-oldchain.pem",
447 &path, &oldroot_, &time_, &unused_result, &unused_errors); 446 &test);
447 path = test.chain;
448 oldroot_ = test.trust_anchor;
449 time_ = test.time;
mattm 2017/04/06 20:29:34 doesn't need to set oldroot_ and time_ from both c
eroman 2017/04/07 21:41:30 Done.
450
448 ASSERT_EQ(2U, path.size()); 451 ASSERT_EQ(2U, path.size());
449 target_ = path[0]; 452 target_ = path[0];
450 oldintermediate_ = path[1]; 453 oldintermediate_ = path[1];
451 ASSERT_TRUE(target_); 454 ASSERT_TRUE(target_);
452 ASSERT_TRUE(oldintermediate_); 455 ASSERT_TRUE(oldintermediate_);
453 456
454 ReadVerifyCertChainTestFromFile( 457 ReadVerifyCertChainTestFromFile(
455 "net/data/verify_certificate_chain_unittest/" 458 "net/data/verify_certificate_chain_unittest/"
456 "key-rollover-longrolloverchain.pem", 459 "key-rollover-longrolloverchain.pem",
457 &path, &oldroot_, &time_, &unused_result, &unused_errors); 460 &test);
461 path = test.chain;
462 oldroot_ = test.trust_anchor;
463 time_ = test.time;
464
458 ASSERT_EQ(4U, path.size()); 465 ASSERT_EQ(4U, path.size());
459 newintermediate_ = path[1]; 466 newintermediate_ = path[1];
460 newroot_ = path[2]; 467 newroot_ = path[2];
461 newrootrollover_ = path[3]; 468 newrootrollover_ = path[3];
462 ASSERT_TRUE(newintermediate_); 469 ASSERT_TRUE(newintermediate_);
463 ASSERT_TRUE(newroot_); 470 ASSERT_TRUE(newroot_);
464 ASSERT_TRUE(newrootrollover_); 471 ASSERT_TRUE(newrootrollover_);
465 } 472 }
466 473
467 protected: 474 protected:
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 const auto& path1 = result.paths[1]->path; 1104 const auto& path1 = result.paths[1]->path;
1098 ASSERT_EQ(2U, path1.certs.size()); 1105 ASSERT_EQ(2U, path1.certs.size());
1099 EXPECT_EQ(target_, path1.certs[0]); 1106 EXPECT_EQ(target_, path1.certs[0]);
1100 EXPECT_EQ(newintermediate_, path1.certs[1]); 1107 EXPECT_EQ(newintermediate_, path1.certs[1]);
1101 EXPECT_EQ(newroot_, path1.trust_anchor->cert()); 1108 EXPECT_EQ(newroot_, path1.trust_anchor->cert());
1102 } 1109 }
1103 1110
1104 } // namespace 1111 } // namespace
1105 1112
1106 } // namespace net 1113 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/cert/internal/path_builder_verify_certificate_chain_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698