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

Unified Diff: net/base/keygen_handler_unittest.cc

Issue 18121007: *WIP* Store NSS slots per profile. Move keygen to chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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/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();

Powered by Google App Engine
This is Rietveld 408576698