OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <cert.h> | 5 #include <cert.h> |
6 #include <certdb.h> | 6 #include <certdb.h> |
7 #include <pk11pub.h> | 7 #include <pk11pub.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // NSSCertDatabase::NotifyObservers* get released. | 61 // NSSCertDatabase::NotifyObservers* get released. |
62 base::MessageLoop::current()->RunUntilIdle(); | 62 base::MessageLoop::current()->RunUntilIdle(); |
63 | 63 |
64 EXPECT_EQ(0U, ListCertsInSlot(slot_->os_module_handle()).size()); | 64 EXPECT_EQ(0U, ListCertsInSlot(slot_->os_module_handle()).size()); |
65 } | 65 } |
66 | 66 |
67 protected: | 67 protected: |
68 static std::string ReadTestFile(const std::string& name) { | 68 static std::string ReadTestFile(const std::string& name) { |
69 std::string result; | 69 std::string result; |
70 base::FilePath cert_path = GetTestCertsDirectory().AppendASCII(name); | 70 base::FilePath cert_path = GetTestCertsDirectory().AppendASCII(name); |
71 EXPECT_TRUE(file_util::ReadFileToString(cert_path, &result)); | 71 EXPECT_TRUE(base::ReadFileToString(cert_path, &result)); |
72 return result; | 72 return result; |
73 } | 73 } |
74 | 74 |
75 static bool ReadCertIntoList(const std::string& name, | 75 static bool ReadCertIntoList(const std::string& name, |
76 CertificateList* certs) { | 76 CertificateList* certs) { |
77 scoped_refptr<X509Certificate> cert( | 77 scoped_refptr<X509Certificate> cert( |
78 ImportCertFromFile(GetTestCertsDirectory(), name)); | 78 ImportCertFromFile(GetTestCertsDirectory(), name)); |
79 if (!cert.get()) | 79 if (!cert.get()) |
80 return false; | 80 return false; |
81 | 81 |
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 EXPECT_EQ(NSSCertDatabase::TRUST_DEFAULT, | 1033 EXPECT_EQ(NSSCertDatabase::TRUST_DEFAULT, |
1034 cert_db_->GetCertTrust(certs2[0].get(), SERVER_CERT)); | 1034 cert_db_->GetCertTrust(certs2[0].get(), SERVER_CERT)); |
1035 | 1035 |
1036 new_certs = ListCertsInSlot(slot_->os_module_handle()); | 1036 new_certs = ListCertsInSlot(slot_->os_module_handle()); |
1037 ASSERT_EQ(2U, new_certs.size()); | 1037 ASSERT_EQ(2U, new_certs.size()); |
1038 EXPECT_STRNE(new_certs[0]->os_cert_handle()->nickname, | 1038 EXPECT_STRNE(new_certs[0]->os_cert_handle()->nickname, |
1039 new_certs[1]->os_cert_handle()->nickname); | 1039 new_certs[1]->os_cert_handle()->nickname); |
1040 } | 1040 } |
1041 | 1041 |
1042 } // namespace net | 1042 } // namespace net |
OLD | NEW |