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

Side by Side Diff: net/ssl/channel_id_service_unittest.cc

Issue 2095523002: Make //crypto factories return std::unique_ptr<>s (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comment Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/ssl/channel_id_service.h" 5 #include "net/ssl/channel_id_service.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
davidben 2016/06/23 03:09:36 No longer used, I think.
15 #include "base/run_loop.h" 15 #include "base/run_loop.h"
16 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
17 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
18 #include "base/task_runner.h" 18 #include "base/task_runner.h"
19 #include "base/threading/thread_task_runner_handle.h" 19 #include "base/threading/thread_task_runner_handle.h"
20 #include "crypto/ec_private_key.h" 20 #include "crypto/ec_private_key.h"
21 #include "net/base/net_errors.h" 21 #include "net/base/net_errors.h"
22 #include "net/base/test_completion_callback.h" 22 #include "net/base/test_completion_callback.h"
23 #include "net/cert/asn1_util.h" 23 #include "net/cert/asn1_util.h"
24 #include "net/cert/x509_certificate.h" 24 #include "net/cert/x509_certificate.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // CallGetChannelIDCallbackWithResult. 93 // CallGetChannelIDCallbackWithResult.
94 return ERR_IO_PENDING; 94 return ERR_IO_PENDING;
95 } 95 }
96 96
97 void MockChannelIDStoreWithAsyncGet::CallGetChannelIDCallbackWithResult( 97 void MockChannelIDStoreWithAsyncGet::CallGetChannelIDCallbackWithResult(
98 int err, 98 int err,
99 crypto::ECPrivateKey* key) { 99 crypto::ECPrivateKey* key) {
100 if (err == OK) 100 if (err == OK)
101 channel_id_count_ = 1; 101 channel_id_count_ = 1;
102 base::ThreadTaskRunnerHandle::Get()->PostTask( 102 base::ThreadTaskRunnerHandle::Get()->PostTask(
103 FROM_HERE, 103 FROM_HERE, base::Bind(callback_, err, server_identifier_,
104 base::Bind(callback_, err, server_identifier_, 104 base::Passed(key ? key->Copy() : nullptr)));
105 base::Passed(base::WrapUnique(key ? key->Copy() : nullptr))));
106 } 105 }
107 106
108 class ChannelIDServiceTest : public testing::Test { 107 class ChannelIDServiceTest : public testing::Test {
109 public: 108 public:
110 ChannelIDServiceTest() 109 ChannelIDServiceTest()
111 : service_(new ChannelIDService(new DefaultChannelIDStore(NULL), 110 : service_(new ChannelIDService(new DefaultChannelIDStore(NULL),
112 base::ThreadTaskRunnerHandle::Get())) {} 111 base::ThreadTaskRunnerHandle::Get())) {}
113 112
114 protected: 113 protected:
115 std::unique_ptr<ChannelIDService> service_; 114 std::unique_ptr<ChannelIDService> service_;
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 EXPECT_EQ(1u, service_->inflight_joins()); 622 EXPECT_EQ(1u, service_->inflight_joins());
624 EXPECT_TRUE(key1); 623 EXPECT_TRUE(key1);
625 EXPECT_TRUE(KeysEqual(key1.get(), key2.get())); 624 EXPECT_TRUE(KeysEqual(key1.get(), key2.get()));
626 EXPECT_FALSE(request1.is_active()); 625 EXPECT_FALSE(request1.is_active());
627 EXPECT_FALSE(request2.is_active()); 626 EXPECT_FALSE(request2.is_active());
628 } 627 }
629 628
630 } // namespace 629 } // namespace
631 630
632 } // namespace net 631 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698