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

Unified Diff: net/cert/test_root_certs_unittest.cc

Issue 137553004: NSS Cros multiprofile: trust roots added by a profile shouldn't apply to other profiles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ios fix Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/cert/test_root_certs_openssl.cc ('k') | net/data/ssl/certificates/README » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/test_root_certs_unittest.cc
diff --git a/net/cert/test_root_certs_unittest.cc b/net/cert/test_root_certs_unittest.cc
index 74c3551862bc6f787f40c250f978c24854e27cf8..81926bee12780d29f0dbe98190b9027767faaeb5 100644
--- a/net/cert/test_root_certs_unittest.cc
+++ b/net/cert/test_root_certs_unittest.cc
@@ -135,6 +135,39 @@ TEST(TestRootCertsTest, OverrideTrust) {
EXPECT_EQ(bad_verify_result.cert_status, restored_verify_result.cert_status);
}
+#if defined(USE_NSS) || (defined(USE_OPENSSL) && !defined(OS_ANDROID))
+TEST(TestRootCertsTest, Contains) {
+ // Another test root certificate.
+ const char kRootCertificateFile2[] = "2048-rsa-root.pem";
+
+ TestRootCerts* test_roots = TestRootCerts::GetInstance();
+ ASSERT_NE(static_cast<TestRootCerts*>(NULL), test_roots);
+
+ scoped_refptr<X509Certificate> root_cert_1 =
+ ImportCertFromFile(GetTestCertsDirectory(), kRootCertificateFile);
+ ASSERT_NE(static_cast<X509Certificate*>(NULL), root_cert_1.get());
+
+ scoped_refptr<X509Certificate> root_cert_2 =
+ ImportCertFromFile(GetTestCertsDirectory(), kRootCertificateFile2);
+ ASSERT_NE(static_cast<X509Certificate*>(NULL), root_cert_2.get());
+
+ EXPECT_FALSE(test_roots->Contains(root_cert_1->os_cert_handle()));
+ EXPECT_FALSE(test_roots->Contains(root_cert_2->os_cert_handle()));
+
+ EXPECT_TRUE(test_roots->Add(root_cert_1.get()));
+ EXPECT_TRUE(test_roots->Contains(root_cert_1->os_cert_handle()));
+ EXPECT_FALSE(test_roots->Contains(root_cert_2->os_cert_handle()));
+
+ EXPECT_TRUE(test_roots->Add(root_cert_2.get()));
+ EXPECT_TRUE(test_roots->Contains(root_cert_1->os_cert_handle()));
+ EXPECT_TRUE(test_roots->Contains(root_cert_2->os_cert_handle()));
+
+ test_roots->Clear();
+ EXPECT_FALSE(test_roots->Contains(root_cert_1->os_cert_handle()));
+ EXPECT_FALSE(test_roots->Contains(root_cert_2->os_cert_handle()));
+}
+#endif
+
// TODO(rsleevi): Add tests for revocation checking via CRLs, ensuring that
// TestRootCerts properly injects itself into the validation process. See
// http://crbug.com/63958
« no previous file with comments | « net/cert/test_root_certs_openssl.cc ('k') | net/data/ssl/certificates/README » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698