Index: net/base/keygen_handler_unittest.cc |
diff --git a/net/base/keygen_handler_unittest.cc b/net/base/keygen_handler_unittest.cc |
index 5188d9d745c37947c4ed9384af4e0eae149232bf..59f8a3dd7e9818e20ddaa3dd7a352c53c330d09a 100644 |
--- a/net/base/keygen_handler_unittest.cc |
+++ b/net/base/keygen_handler_unittest.cc |
@@ -19,6 +19,9 @@ |
#if defined(USE_NSS) |
#include <private/pprthred.h> // PR_DetachThread |
+ |
+#include "crypto/nss_util.h" |
+#include "crypto/nss_util_internal.h" |
#endif |
namespace net { |
@@ -31,8 +34,11 @@ class KeygenHandlerTest : public ::testing::Test { |
virtual ~KeygenHandlerTest() {} |
virtual void SetUp() { |
+#if defined(USE_NSS) |
+ crypto::EnsureNSSInit(); |
+#endif |
#if defined(OS_CHROMEOS) |
- crypto::OpenPersistentNSSDB(); |
+ crypto::OpenPersistentNSSDB(); |
#endif |
} |
}; |
@@ -75,6 +81,9 @@ void AssertValidSignedPublicKeyAndChallenge(const std::string& result, |
TEST_F(KeygenHandlerTest, SmokeTest) { |
KeygenHandler handler(768, "some challenge", GURL("http://www.example.com")); |
+#if defined(USE_NSS) |
+ handler.set_key_slot(crypto::ScopedPK11Slot(crypto::GetPrivateNSSKeySlot())); |
+#endif |
handler.set_stores_key(false); // Don't leave the key-pair behind |
std::string result = handler.GenKeyAndSignChallenge(); |
VLOG(1) << "KeygenHandler produced: " << result; |
@@ -88,6 +97,9 @@ void ConcurrencyTestCallback(base::WaitableEvent* event, |
// WaitableEvent to synchronize, so it's safe. |
base::ThreadRestrictions::ScopedAllowSingleton scoped_allow_singleton; |
KeygenHandler handler(768, challenge, GURL("http://www.example.com")); |
+#if defined(USE_NSS) |
+ handler.set_key_slot(crypto::ScopedPK11Slot(crypto::GetPrivateNSSKeySlot())); |
+#endif |
handler.set_stores_key(false); // Don't leave the key-pair behind. |
*result = handler.GenKeyAndSignChallenge(); |
event->Signal(); |