Index: net/cert/internal/trust_store_collection_unittest.cc |
diff --git a/net/cert/internal/trust_store_collection_unittest.cc b/net/cert/internal/trust_store_collection_unittest.cc |
index 198988e78c6a2d14c75609a44f529c9ceb181d1b..462f66bcf8f3a44760aa2b9213e3c6bb027440a0 100644 |
--- a/net/cert/internal/trust_store_collection_unittest.cc |
+++ b/net/cert/internal/trust_store_collection_unittest.cc |
@@ -59,31 +59,54 @@ class TrustStoreCollectionTest : public testing::Test { |
// Collection contains no stores, should return no results. |
TEST_F(TrustStoreCollectionTest, NoStores) { |
- TrustAnchors matches; |
+ TrustAnchors anchors; |
+ ParsedCertificateList intermediates; |
TrustStoreCollection collection; |
- collection.FindTrustAnchorsForCert(target_, &matches); |
+ collection.FindIssuers(target_, &anchors, &intermediates); |
- EXPECT_TRUE(matches.empty()); |
+ EXPECT_TRUE(anchors.empty()); |
+ EXPECT_TRUE(intermediates.empty()); |
} |
// Collection contains only one store. |
TEST_F(TrustStoreCollectionTest, OneStore) { |
- TrustAnchors matches; |
+ TrustAnchors anchors; |
+ ParsedCertificateList intermediates; |
TrustStoreCollection collection; |
TrustStoreInMemory in_memory; |
in_memory.AddTrustAnchor(newroot_); |
collection.AddTrustStore(&in_memory); |
- collection.FindTrustAnchorsForCert(newintermediate_, &matches); |
+ collection.FindIssuers(newintermediate_, &anchors, &intermediates); |
mattm
2017/04/20 03:19:07
These tests should all check the returned intermed
|
- ASSERT_EQ(1U, matches.size()); |
- EXPECT_EQ(newroot_, matches[0]); |
+ ASSERT_EQ(1U, anchors.size()); |
+ EXPECT_EQ(newroot_, anchors[0]); |
+} |
+ |
+// LookupCert() should append to its output parameters rather than assign them. |
+TEST_F(TrustStoreCollectionTest, OutputVectorsAppendedTo) { |
+ TrustAnchors anchors; |
+ ParsedCertificateList intermediates; |
+ |
+ // Populate the out-parameters with some values. |
+ anchors.resize(3); |
+ intermediates.resize(5); |
+ |
+ TrustStoreCollection collection; |
+ TrustStoreInMemory in_memory; |
+ in_memory.AddTrustAnchor(newroot_); |
+ collection.AddTrustStore(&in_memory); |
+ collection.FindIssuers(newintermediate_, &anchors, &intermediates); |
+ |
+ ASSERT_EQ(4U, anchors.size()); |
+ EXPECT_EQ(newroot_, anchors[3]); |
} |
// Collection contains two stores. |
TEST_F(TrustStoreCollectionTest, TwoStores) { |
- TrustAnchors matches; |
+ TrustAnchors anchors; |
+ ParsedCertificateList intermediates; |
TrustStoreCollection collection; |
TrustStoreInMemory in_memory1; |
@@ -92,11 +115,11 @@ TEST_F(TrustStoreCollectionTest, TwoStores) { |
in_memory2.AddTrustAnchor(oldroot_); |
collection.AddTrustStore(&in_memory1); |
collection.AddTrustStore(&in_memory2); |
- collection.FindTrustAnchorsForCert(newintermediate_, &matches); |
+ collection.FindIssuers(newintermediate_, &anchors, &intermediates); |
- ASSERT_EQ(2U, matches.size()); |
- EXPECT_EQ(newroot_, matches[0]); |
- EXPECT_EQ(oldroot_, matches[1]); |
+ ASSERT_EQ(2U, anchors.size()); |
+ EXPECT_EQ(newroot_, anchors[0]); |
+ EXPECT_EQ(oldroot_, anchors[1]); |
} |
} // namespace |