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

Side by Side Diff: net/base/keygen_handler_unittest.cc

Issue 401623006: Extract ScopedTestNSSDB from nss_util. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/base/keygen_handler.h" 5 #include "net/base/keygen_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/threading/worker_pool.h" 13 #include "base/threading/worker_pool.h"
14 #include "base/threading/thread_restrictions.h" 14 #include "base/threading/thread_restrictions.h"
15 #include "base/synchronization/waitable_event.h" 15 #include "base/synchronization/waitable_event.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 #if defined(USE_NSS) 19 #if defined(USE_NSS)
20 #include <private/pprthred.h> // PR_DetachThread 20 #include <private/pprthred.h> // PR_DetachThread
21 #include "crypto/nss_crypto_module_delegate.h" 21 #include "crypto/nss_crypto_module_delegate.h"
22 #include "crypto/nss_util.h" 22 #include "crypto/scoped_test_nss_db.h"
23 #include "crypto/nss_util_internal.h"
24 #endif 23 #endif
25 24
26 namespace net { 25 namespace net {
27 26
28 namespace { 27 namespace {
29 28
30 #if defined(USE_NSS) 29 #if defined(USE_NSS)
31 class StubCryptoModuleDelegate : public crypto::NSSCryptoModuleDelegate { 30 class StubCryptoModuleDelegate : public crypto::NSSCryptoModuleDelegate {
32 public: 31 public:
33 explicit StubCryptoModuleDelegate(crypto::ScopedPK11Slot slot) 32 explicit StubCryptoModuleDelegate(crypto::ScopedPK11Slot slot)
(...skipping 18 matching lines...) Expand all
52 public: 51 public:
53 KeygenHandlerTest() {} 52 KeygenHandlerTest() {}
54 virtual ~KeygenHandlerTest() {} 53 virtual ~KeygenHandlerTest() {}
55 54
56 scoped_ptr<KeygenHandler> CreateKeygenHandler() { 55 scoped_ptr<KeygenHandler> CreateKeygenHandler() {
57 scoped_ptr<KeygenHandler> handler(new KeygenHandler( 56 scoped_ptr<KeygenHandler> handler(new KeygenHandler(
58 768, "some challenge", GURL("http://www.example.com"))); 57 768, "some challenge", GURL("http://www.example.com")));
59 #if defined(USE_NSS) 58 #if defined(USE_NSS)
60 handler->set_crypto_module_delegate( 59 handler->set_crypto_module_delegate(
61 scoped_ptr<crypto::NSSCryptoModuleDelegate>( 60 scoped_ptr<crypto::NSSCryptoModuleDelegate>(
62 new StubCryptoModuleDelegate( 61 new StubCryptoModuleDelegate(crypto::ScopedPK11Slot(
63 crypto::ScopedPK11Slot(crypto::GetPersistentNSSKeySlot())))); 62 PK11_ReferenceSlot(test_nss_db_.slot())))));
64 #endif 63 #endif
65 return handler.Pass(); 64 return handler.Pass();
66 } 65 }
67 66
68 private: 67 private:
69 #if defined(USE_NSS) 68 #if defined(USE_NSS)
70 crypto::ScopedTestNSSDB test_nss_db_; 69 crypto::ScopedTestNSSDB test_nss_db_;
71 #endif 70 #endif
72 }; 71 };
73 72
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 events[i] = NULL; 161 events[i] = NULL;
163 162
164 VLOG(1) << "KeygenHandler " << i << " produced: " << results[i]; 163 VLOG(1) << "KeygenHandler " << i << " produced: " << results[i];
165 AssertValidSignedPublicKeyAndChallenge(results[i], "some challenge"); 164 AssertValidSignedPublicKeyAndChallenge(results[i], "some challenge");
166 } 165 }
167 } 166 }
168 167
169 } // namespace 168 } // namespace
170 169
171 } // namespace net 170 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698