Commit ec676214 authored by mattm's avatar mattm Committed by Commit bot

Fix PathBuilderKeyRolloverTest.TestMultipleRootMatchesOnlyOneWorks...

Fix PathBuilderKeyRolloverTest.TestMultipleRootMatchesOnlyOneWorks unordered_multimap ordering dependency.

BUG=670889

Review-Url: https://codereview.chromium.org/2550893002
Cr-Commit-Position: refs/heads/master@{#436121}
parent 8c972de6
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "net/cert/internal/parsed_certificate.h" #include "net/cert/internal/parsed_certificate.h"
#include "net/cert/internal/signature_policy.h" #include "net/cert/internal/signature_policy.h"
#include "net/cert/internal/test_helpers.h" #include "net/cert/internal/test_helpers.h"
#include "net/cert/internal/trust_store_collection.h"
#include "net/cert/internal/trust_store_in_memory.h" #include "net/cert/internal/trust_store_in_memory.h"
#include "net/cert/internal/verify_certificate_chain.h" #include "net/cert/internal/verify_certificate_chain.h"
#include "net/cert/pem_tokenizer.h" #include "net/cert/pem_tokenizer.h"
...@@ -592,12 +593,17 @@ TEST_F(PathBuilderKeyRolloverTest, TestAnchorsNoMatchAndNoIssuerSources) { ...@@ -592,12 +593,17 @@ TEST_F(PathBuilderKeyRolloverTest, TestAnchorsNoMatchAndNoIssuerSources) {
// Both roots have the same subject but different keys. Only one of them will // Both roots have the same subject but different keys. Only one of them will
// verify. // verify.
TEST_F(PathBuilderKeyRolloverTest, TestMultipleRootMatchesOnlyOneWorks) { TEST_F(PathBuilderKeyRolloverTest, TestMultipleRootMatchesOnlyOneWorks) {
TrustStoreInMemory trust_store; TrustStoreCollection trust_store_collection;
TrustStoreInMemory trust_store1;
TrustStoreInMemory trust_store2;
trust_store_collection.AddTrustStore(&trust_store1);
trust_store_collection.AddTrustStore(&trust_store2);
// Add two trust anchors (newroot_ and oldroot_). Path building will attempt // Add two trust anchors (newroot_ and oldroot_). Path building will attempt
// them in this same order. // them in this same order, as trust_store1 was added to
trust_store.AddTrustAnchor( // trust_store_collection first.
trust_store1.AddTrustAnchor(
TrustAnchor::CreateFromCertificateNoConstraints(newroot_)); TrustAnchor::CreateFromCertificateNoConstraints(newroot_));
trust_store.AddTrustAnchor(oldroot_); trust_store2.AddTrustAnchor(oldroot_);
// Only oldintermediate is supplied, so the path with newroot should fail, // Only oldintermediate is supplied, so the path with newroot should fail,
// oldroot should succeed. // oldroot should succeed.
...@@ -605,8 +611,8 @@ TEST_F(PathBuilderKeyRolloverTest, TestMultipleRootMatchesOnlyOneWorks) { ...@@ -605,8 +611,8 @@ TEST_F(PathBuilderKeyRolloverTest, TestMultipleRootMatchesOnlyOneWorks) {
sync_certs.AddCert(oldintermediate_); sync_certs.AddCert(oldintermediate_);
CertPathBuilder::Result result; CertPathBuilder::Result result;
CertPathBuilder path_builder(target_, &trust_store, &signature_policy_, time_, CertPathBuilder path_builder(target_, &trust_store_collection,
&result); &signature_policy_, time_, &result);
path_builder.AddCertIssuerSource(&sync_certs); path_builder.AddCertIssuerSource(&sync_certs);
path_builder.Run(); path_builder.Run();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment