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

Unified Diff: net/cert/nss_profile_filter_chromeos_unittest.cc

Issue 144423007: Make NSSCertDatabase::ListCerts work async on a worker thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: aa Created 6 years, 11 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
Index: net/cert/nss_profile_filter_chromeos_unittest.cc
diff --git a/net/cert/nss_profile_filter_chromeos_unittest.cc b/net/cert/nss_profile_filter_chromeos_unittest.cc
index 8f3806186139fb97608dcd718cc9b9653e9b7558..4b172a7c8acfe3f5ede27aec5b2d21b9e846230b 100644
--- a/net/cert/nss_profile_filter_chromeos_unittest.cc
+++ b/net/cert/nss_profile_filter_chromeos_unittest.cc
@@ -55,7 +55,13 @@ CertificateList ListCertsInSlot(PK11SlotInfo* slot) {
class NSSProfileFilterChromeOSTest : public testing::Test {
public:
- NSSProfileFilterChromeOSTest() : user_1_("user1"), user_2_("user2") {}
+ NSSProfileFilterChromeOSTest()
+ : user_1_("user1"),
+ user_2_("user2"),
+ no_slots_profile_filter_(new NSSProfileFilterChromeOS()),
+ profile_filter_1_(new NSSProfileFilterChromeOS()),
+ profile_filter_2_(new NSSProfileFilterChromeOS()) {
+ }
virtual void SetUp() OVERRIDE {
// Initialize nss_util slots.
@@ -72,7 +78,7 @@ class NSSProfileFilterChromeOSTest : public testing::Test {
user_1_.username_hash(),
base::Callback<void(crypto::ScopedPK11Slot)>()));
ASSERT_TRUE(private_slot_1.get());
- profile_filter_1_.Init(
+ profile_filter_1_->Init(
crypto::GetPublicSlotForChromeOSUser(user_1_.username_hash()),
private_slot_1.Pass());
@@ -80,7 +86,7 @@ class NSSProfileFilterChromeOSTest : public testing::Test {
user_2_.username_hash(),
base::Callback<void(crypto::ScopedPK11Slot)>()));
ASSERT_TRUE(private_slot_2.get());
- profile_filter_2_.Init(
+ profile_filter_2_->Init(
crypto::GetPublicSlotForChromeOSUser(user_2_.username_hash()),
private_slot_2.Pass());
@@ -94,45 +100,45 @@ class NSSProfileFilterChromeOSTest : public testing::Test {
CertificateList certs_;
crypto::ScopedTestNSSChromeOSUser user_1_;
crypto::ScopedTestNSSChromeOSUser user_2_;
- NSSProfileFilterChromeOS no_slots_profile_filter_;
- NSSProfileFilterChromeOS profile_filter_1_;
- NSSProfileFilterChromeOS profile_filter_2_;
+ scoped_refptr<NSSProfileFilterChromeOS> no_slots_profile_filter_;
+ scoped_refptr<NSSProfileFilterChromeOS> profile_filter_1_;
+ scoped_refptr<NSSProfileFilterChromeOS> profile_filter_2_;
};
TEST_F(NSSProfileFilterChromeOSTest, TempCertAllowed) {
EXPECT_EQ(NULL, certs_[0]->os_cert_handle()->slot);
- EXPECT_TRUE(no_slots_profile_filter_.IsCertAllowed(certs_[0]));
- EXPECT_TRUE(profile_filter_1_.IsCertAllowed(certs_[0]));
- EXPECT_TRUE(profile_filter_2_.IsCertAllowed(certs_[0]));
+ EXPECT_TRUE(no_slots_profile_filter_->IsCertAllowed(certs_[0]));
+ EXPECT_TRUE(profile_filter_1_->IsCertAllowed(certs_[0]));
+ EXPECT_TRUE(profile_filter_2_->IsCertAllowed(certs_[0]));
}
TEST_F(NSSProfileFilterChromeOSTest, InternalSlotAllowed) {
crypto::ScopedPK11Slot internal_slot(PK11_GetInternalSlot());
ASSERT_TRUE(internal_slot.get());
- EXPECT_TRUE(no_slots_profile_filter_.IsModuleAllowed(internal_slot.get()));
- EXPECT_TRUE(profile_filter_1_.IsModuleAllowed(internal_slot.get()));
- EXPECT_TRUE(profile_filter_2_.IsModuleAllowed(internal_slot.get()));
+ EXPECT_TRUE(no_slots_profile_filter_->IsModuleAllowed(internal_slot.get()));
+ EXPECT_TRUE(profile_filter_1_->IsModuleAllowed(internal_slot.get()));
+ EXPECT_TRUE(profile_filter_2_->IsModuleAllowed(internal_slot.get()));
crypto::ScopedPK11Slot internal_key_slot(PK11_GetInternalKeySlot());
ASSERT_TRUE(internal_key_slot.get());
EXPECT_TRUE(
- no_slots_profile_filter_.IsModuleAllowed(internal_key_slot.get()));
- EXPECT_TRUE(profile_filter_1_.IsModuleAllowed(internal_key_slot.get()));
- EXPECT_TRUE(profile_filter_2_.IsModuleAllowed(internal_key_slot.get()));
+ no_slots_profile_filter_->IsModuleAllowed(internal_key_slot.get()));
+ EXPECT_TRUE(profile_filter_1_->IsModuleAllowed(internal_key_slot.get()));
+ EXPECT_TRUE(profile_filter_2_->IsModuleAllowed(internal_key_slot.get()));
}
TEST_F(NSSProfileFilterChromeOSTest, RootCertsAllowed) {
crypto::ScopedPK11Slot root_certs_slot(GetRootCertsSlot());
ASSERT_TRUE(root_certs_slot.get());
- EXPECT_TRUE(no_slots_profile_filter_.IsModuleAllowed(root_certs_slot.get()));
- EXPECT_TRUE(profile_filter_1_.IsModuleAllowed(root_certs_slot.get()));
- EXPECT_TRUE(profile_filter_2_.IsModuleAllowed(root_certs_slot.get()));
+ EXPECT_TRUE(no_slots_profile_filter_->IsModuleAllowed(root_certs_slot.get()));
+ EXPECT_TRUE(profile_filter_1_->IsModuleAllowed(root_certs_slot.get()));
+ EXPECT_TRUE(profile_filter_2_->IsModuleAllowed(root_certs_slot.get()));
CertificateList root_certs(ListCertsInSlot(root_certs_slot.get()));
ASSERT_FALSE(root_certs.empty());
- EXPECT_TRUE(no_slots_profile_filter_.IsCertAllowed(root_certs[0]));
- EXPECT_TRUE(profile_filter_1_.IsCertAllowed(root_certs[0]));
- EXPECT_TRUE(profile_filter_2_.IsCertAllowed(root_certs[0]));
+ EXPECT_TRUE(no_slots_profile_filter_->IsCertAllowed(root_certs[0]));
+ EXPECT_TRUE(profile_filter_1_->IsCertAllowed(root_certs[0]));
+ EXPECT_TRUE(profile_filter_2_->IsCertAllowed(root_certs[0]));
}
TEST_F(NSSProfileFilterChromeOSTest, SoftwareSlots) {
@@ -163,14 +169,14 @@ TEST_F(NSSProfileFilterChromeOSTest, SoftwareSlots) {
"cert2",
PR_FALSE /* includeTrust (unused) */));
- EXPECT_FALSE(no_slots_profile_filter_.IsCertAllowed(cert_1));
- EXPECT_FALSE(no_slots_profile_filter_.IsCertAllowed(cert_2));
+ EXPECT_FALSE(no_slots_profile_filter_->IsCertAllowed(cert_1));
+ EXPECT_FALSE(no_slots_profile_filter_->IsCertAllowed(cert_2));
- EXPECT_TRUE(profile_filter_1_.IsCertAllowed(cert_1));
- EXPECT_FALSE(profile_filter_1_.IsCertAllowed(cert_2));
+ EXPECT_TRUE(profile_filter_1_->IsCertAllowed(cert_1));
+ EXPECT_FALSE(profile_filter_1_->IsCertAllowed(cert_2));
- EXPECT_FALSE(profile_filter_2_.IsCertAllowed(cert_1));
- EXPECT_TRUE(profile_filter_2_.IsCertAllowed(cert_2));
+ EXPECT_FALSE(profile_filter_2_->IsCertAllowed(cert_1));
+ EXPECT_TRUE(profile_filter_2_->IsCertAllowed(cert_2));
}
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698