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" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 ASSERT_TRUE(user_1_.constructed_successfully()); | 52 ASSERT_TRUE(user_1_.constructed_successfully()); |
53 ASSERT_TRUE(user_2_.constructed_successfully()); | 53 ASSERT_TRUE(user_2_.constructed_successfully()); |
54 user_1_.FinishInit(); | 54 user_1_.FinishInit(); |
55 user_2_.FinishInit(); | 55 user_2_.FinishInit(); |
56 | 56 |
57 // Create NSSCertDatabaseChromeOS for each user. | 57 // Create NSSCertDatabaseChromeOS for each user. |
58 db_1_.reset(new NSSCertDatabaseChromeOS( | 58 db_1_.reset(new NSSCertDatabaseChromeOS( |
59 crypto::GetPublicSlotForChromeOSUser(user_1_.username_hash()), | 59 crypto::GetPublicSlotForChromeOSUser(user_1_.username_hash()), |
60 crypto::GetPrivateSlotForChromeOSUser( | 60 crypto::GetPrivateSlotForChromeOSUser( |
61 user_1_.username_hash(), | 61 user_1_.username_hash(), |
62 base::Callback<void(crypto::ScopedPK11Slot)>()))); | 62 base::Callback<void(crypto::ScopedPK11Slot)>()), |
| 63 crypto::ScopedPK11Slot())); |
63 db_1_->SetSlowTaskRunnerForTest(base::MessageLoopProxy::current()); | 64 db_1_->SetSlowTaskRunnerForTest(base::MessageLoopProxy::current()); |
64 db_2_.reset(new NSSCertDatabaseChromeOS( | 65 db_2_.reset(new NSSCertDatabaseChromeOS( |
65 crypto::GetPublicSlotForChromeOSUser(user_2_.username_hash()), | 66 crypto::GetPublicSlotForChromeOSUser(user_2_.username_hash()), |
66 crypto::GetPrivateSlotForChromeOSUser( | 67 crypto::GetPrivateSlotForChromeOSUser( |
67 user_2_.username_hash(), | 68 user_2_.username_hash(), |
68 base::Callback<void(crypto::ScopedPK11Slot)>()))); | 69 base::Callback<void(crypto::ScopedPK11Slot)>()), |
| 70 crypto::ScopedPK11Slot())); |
69 db_2_->SetSlowTaskRunnerForTest(base::MessageLoopProxy::current()); | 71 db_2_->SetSlowTaskRunnerForTest(base::MessageLoopProxy::current()); |
70 | 72 |
71 // Add observer to CertDatabase for checking that notifications from | 73 // Add observer to CertDatabase for checking that notifications from |
72 // NSSCertDatabaseChromeOS are proxied to the CertDatabase. | 74 // NSSCertDatabaseChromeOS are proxied to the CertDatabase. |
73 CertDatabase::GetInstance()->AddObserver(this); | 75 CertDatabase::GetInstance()->AddObserver(this); |
74 observer_added_ = true; | 76 observer_added_ = true; |
75 } | 77 } |
76 | 78 |
77 virtual void TearDown() OVERRIDE { | 79 virtual void TearDown() OVERRIDE { |
78 if (observer_added_) | 80 if (observer_added_) |
(...skipping 191 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 |