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/cert/nss_cert_database_chromeos.h" | 5 #include "net/cert/nss_cert_database_chromeos.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
11 #include "crypto/nss_util_internal.h" | 11 #include "crypto/nss_util_internal.h" |
12 #include "crypto/scoped_test_nss_chromeos_user.h" | 12 #include "crypto/scoped_test_nss_chromeos_user.h" |
| 13 #include "crypto/scoped_test_nss_db.h" |
13 #include "net/base/test_data_directory.h" | 14 #include "net/base/test_data_directory.h" |
14 #include "net/cert/cert_database.h" | 15 #include "net/cert/cert_database.h" |
15 #include "net/test/cert_test_util.h" | 16 #include "net/test/cert_test_util.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 | 18 |
18 namespace net { | 19 namespace net { |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 bool IsCertInCertificateList(const X509Certificate* cert, | 23 bool IsCertInCertificateList(const X509Certificate* cert, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 } | 92 } |
92 | 93 |
93 protected: | 94 protected: |
94 bool observer_added_; | 95 bool observer_added_; |
95 // Certificates that were passed to the CertDatabase observers. | 96 // Certificates that were passed to the CertDatabase observers. |
96 std::vector<CERTCertificate*> added_ca_; | 97 std::vector<CERTCertificate*> added_ca_; |
97 std::vector<CERTCertificate*> added_; | 98 std::vector<CERTCertificate*> added_; |
98 | 99 |
99 crypto::ScopedTestNSSChromeOSUser user_1_; | 100 crypto::ScopedTestNSSChromeOSUser user_1_; |
100 crypto::ScopedTestNSSChromeOSUser user_2_; | 101 crypto::ScopedTestNSSChromeOSUser user_2_; |
| 102 crypto::ScopedTestNSSDB system_db_; |
101 scoped_ptr<NSSCertDatabaseChromeOS> db_1_; | 103 scoped_ptr<NSSCertDatabaseChromeOS> db_1_; |
102 scoped_ptr<NSSCertDatabaseChromeOS> db_2_; | 104 scoped_ptr<NSSCertDatabaseChromeOS> db_2_; |
103 }; | 105 }; |
104 | 106 |
105 // Test that ListModules() on each user includes that user's NSS software slot, | 107 // Test that ListModules() on each user includes that user's NSS software slot, |
106 // and does not include the software slot of the other user. (Does not check the | 108 // and does not include the software slot of the other user. (Does not check the |
107 // private slot, since it is the same as the public slot in tests.) | 109 // private slot, since it is the same as the public slot in tests.) |
108 TEST_F(NSSCertDatabaseChromeOSTest, ListModules) { | 110 TEST_F(NSSCertDatabaseChromeOSTest, ListModules) { |
109 CryptoModuleList modules_1; | 111 CryptoModuleList modules_1; |
110 CryptoModuleList modules_2; | 112 CryptoModuleList modules_2; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 EXPECT_EQ(0U, certlist.size()); | 272 EXPECT_EQ(0U, certlist.size()); |
271 | 273 |
272 db_1_.reset(); | 274 db_1_.reset(); |
273 | 275 |
274 base::RunLoop().RunUntilIdle(); | 276 base::RunLoop().RunUntilIdle(); |
275 | 277 |
276 EXPECT_LT(0U, certlist.size()); | 278 EXPECT_LT(0U, certlist.size()); |
277 } | 279 } |
278 | 280 |
279 } // namespace net | 281 } // namespace net |
OLD | NEW |