OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ssl/client_cert_store_mac.h" | 5 #include "net/ssl/client_cert_store_mac.h" |
6 | 6 |
7 #include "net/ssl/client_cert_store_unittest-inl.h" | 7 #include "net/ssl/client_cert_store_unittest-inl.h" |
8 | 8 |
9 namespace net { | 9 namespace net { |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 }; | 41 }; |
42 | 42 |
43 // Verify that the preferred cert gets filtered out when it doesn't match the | 43 // Verify that the preferred cert gets filtered out when it doesn't match the |
44 // server criteria. | 44 // server criteria. |
45 TEST_F(ClientCertStoreMacTest, FilterOutThePreferredCert) { | 45 TEST_F(ClientCertStoreMacTest, FilterOutThePreferredCert) { |
46 scoped_refptr<X509Certificate> cert_1( | 46 scoped_refptr<X509Certificate> cert_1( |
47 ImportCertFromFile(GetTestCertsDirectory(), "client_1.pem")); | 47 ImportCertFromFile(GetTestCertsDirectory(), "client_1.pem")); |
48 ASSERT_TRUE(cert_1.get()); | 48 ASSERT_TRUE(cert_1.get()); |
49 | 49 |
50 std::vector<std::string> authority_2( | 50 std::vector<std::string> authority_2( |
51 1, std::string(reinterpret_cast<const char*>(kAuthority2DN), | 51 1, |
52 sizeof(kAuthority2DN))); | 52 std::string(reinterpret_cast<const char*>(kAuthority2DN), |
| 53 sizeof(kAuthority2DN))); |
53 EXPECT_FALSE(cert_1->IsIssuedByEncoded(authority_2)); | 54 EXPECT_FALSE(cert_1->IsIssuedByEncoded(authority_2)); |
54 | 55 |
55 std::vector<scoped_refptr<X509Certificate> > certs; | 56 std::vector<scoped_refptr<X509Certificate> > certs; |
56 scoped_refptr<SSLCertRequestInfo> request(new SSLCertRequestInfo()); | 57 scoped_refptr<SSLCertRequestInfo> request(new SSLCertRequestInfo()); |
57 request->cert_authorities = authority_2; | 58 request->cert_authorities = authority_2; |
58 | 59 |
59 std::vector<scoped_refptr<X509Certificate> > selected_certs; | 60 std::vector<scoped_refptr<X509Certificate> > selected_certs; |
60 bool rv = SelectClientCertsGivenPreferred( | 61 bool rv = SelectClientCertsGivenPreferred( |
61 cert_1, certs, *request.get(), &selected_certs); | 62 cert_1, certs, *request.get(), &selected_certs); |
62 EXPECT_TRUE(rv); | 63 EXPECT_TRUE(rv); |
(...skipping 17 matching lines...) Expand all Loading... |
80 std::vector<scoped_refptr<X509Certificate> > selected_certs; | 81 std::vector<scoped_refptr<X509Certificate> > selected_certs; |
81 bool rv = SelectClientCertsGivenPreferred( | 82 bool rv = SelectClientCertsGivenPreferred( |
82 cert_1, certs, *request.get(), &selected_certs); | 83 cert_1, certs, *request.get(), &selected_certs); |
83 EXPECT_TRUE(rv); | 84 EXPECT_TRUE(rv); |
84 ASSERT_EQ(2u, selected_certs.size()); | 85 ASSERT_EQ(2u, selected_certs.size()); |
85 EXPECT_TRUE(selected_certs[0]->Equals(cert_1.get())); | 86 EXPECT_TRUE(selected_certs[0]->Equals(cert_1.get())); |
86 EXPECT_TRUE(selected_certs[1]->Equals(cert_2.get())); | 87 EXPECT_TRUE(selected_certs[1]->Equals(cert_2.get())); |
87 } | 88 } |
88 | 89 |
89 } // namespace net | 90 } // namespace net |
OLD | NEW |