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

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

Issue 1545233002: Convert Pass()→std::move() in //net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
« no previous file with comments | « net/base/keygen_handler_nss.cc ('k') | net/base/layered_network_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <utility>
8 9
9 #include "base/base64.h" 10 #include "base/base64.h"
10 #include "base/bind.h" 11 #include "base/bind.h"
11 #include "base/location.h" 12 #include "base/location.h"
12 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/synchronization/waitable_event.h"
15 #include "base/threading/thread_restrictions.h"
13 #include "base/threading/worker_pool.h" 16 #include "base/threading/worker_pool.h"
14 #include "base/threading/thread_restrictions.h"
15 #include "base/synchronization/waitable_event.h"
16 #include "build/build_config.h" 17 #include "build/build_config.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 19
19 #if defined(USE_NSS_CERTS) 20 #if defined(USE_NSS_CERTS)
20 #include <private/pprthred.h> // PR_DetachThread 21 #include <private/pprthred.h> // PR_DetachThread
21 #include "crypto/nss_crypto_module_delegate.h" 22 #include "crypto/nss_crypto_module_delegate.h"
22 #include "crypto/scoped_test_nss_db.h" 23 #include "crypto/scoped_test_nss_db.h"
23 #endif 24 #endif
24 25
25 namespace net { 26 namespace net {
26 27
27 namespace { 28 namespace {
28 29
29 #if defined(USE_NSS_CERTS) 30 #if defined(USE_NSS_CERTS)
30 class StubCryptoModuleDelegate : public crypto::NSSCryptoModuleDelegate { 31 class StubCryptoModuleDelegate : public crypto::NSSCryptoModuleDelegate {
31 public: 32 public:
32 explicit StubCryptoModuleDelegate(crypto::ScopedPK11Slot slot) 33 explicit StubCryptoModuleDelegate(crypto::ScopedPK11Slot slot)
33 : slot_(slot.Pass()) {} 34 : slot_(std::move(slot)) {}
34 35
35 std::string RequestPassword(const std::string& slot_name, 36 std::string RequestPassword(const std::string& slot_name,
36 bool retry, 37 bool retry,
37 bool* cancelled) override { 38 bool* cancelled) override {
38 return std::string(); 39 return std::string();
39 } 40 }
40 41
41 crypto::ScopedPK11Slot RequestSlot() override { 42 crypto::ScopedPK11Slot RequestSlot() override {
42 return crypto::ScopedPK11Slot(PK11_ReferenceSlot(slot_.get())); 43 return crypto::ScopedPK11Slot(PK11_ReferenceSlot(slot_.get()));
43 } 44 }
(...skipping 10 matching lines...) Expand all
54 55
55 scoped_ptr<KeygenHandler> CreateKeygenHandler() { 56 scoped_ptr<KeygenHandler> CreateKeygenHandler() {
56 scoped_ptr<KeygenHandler> handler(new KeygenHandler( 57 scoped_ptr<KeygenHandler> handler(new KeygenHandler(
57 768, "some challenge", GURL("http://www.example.com"))); 58 768, "some challenge", GURL("http://www.example.com")));
58 #if defined(USE_NSS_CERTS) 59 #if defined(USE_NSS_CERTS)
59 handler->set_crypto_module_delegate( 60 handler->set_crypto_module_delegate(
60 scoped_ptr<crypto::NSSCryptoModuleDelegate>( 61 scoped_ptr<crypto::NSSCryptoModuleDelegate>(
61 new StubCryptoModuleDelegate(crypto::ScopedPK11Slot( 62 new StubCryptoModuleDelegate(crypto::ScopedPK11Slot(
62 PK11_ReferenceSlot(test_nss_db_.slot()))))); 63 PK11_ReferenceSlot(test_nss_db_.slot())))));
63 #endif 64 #endif
64 return handler.Pass(); 65 return handler;
65 } 66 }
66 67
67 private: 68 private:
68 #if defined(USE_NSS_CERTS) 69 #if defined(USE_NSS_CERTS)
69 crypto::ScopedTestNSSDB test_nss_db_; 70 crypto::ScopedTestNSSDB test_nss_db_;
70 #endif 71 #endif
71 }; 72 };
72 73
73 // Assert that |result| is a valid output for KeygenHandler given challenge 74 // Assert that |result| is a valid output for KeygenHandler given challenge
74 // string of |challenge|. 75 // string of |challenge|.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 events[i] = NULL; 162 events[i] = NULL;
162 163
163 VLOG(1) << "KeygenHandler " << i << " produced: " << results[i]; 164 VLOG(1) << "KeygenHandler " << i << " produced: " << results[i];
164 AssertValidSignedPublicKeyAndChallenge(results[i], "some challenge"); 165 AssertValidSignedPublicKeyAndChallenge(results[i], "some challenge");
165 } 166 }
166 } 167 }
167 168
168 } // namespace 169 } // namespace
169 170
170 } // namespace net 171 } // namespace net
OLDNEW
« no previous file with comments | « net/base/keygen_handler_nss.cc ('k') | net/base/layered_network_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698