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

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

Issue 839143002: Roll Chrome into Mojo. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Rebase Created 5 years, 11 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/spdy/spdy_proxy_client_socket.cc ('k') | net/ssl/openssl_ssl_util.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/openssl_client_key_store.h" 5 #include "net/ssl/openssl_client_key_store.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "crypto/scoped_openssl_types.h" 8 #include "crypto/scoped_openssl_types.h"
9 #include "net/base/test_data_directory.h" 9 #include "net/base/test_data_directory.h"
10 #include "net/test/cert_test_util.h" 10 #include "net/test/cert_test_util.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 namespace net { 13 namespace net {
14 14
15 namespace { 15 namespace {
16 16
17 // Return the internal reference count of a given EVP_PKEY. 17 // Return the internal reference count of a given EVP_PKEY.
18 int EVP_PKEY_get_refcount(EVP_PKEY* pkey) { 18 int EVP_PKEY_get_refcount(EVP_PKEY* pkey) {
19 return pkey->references; 19 return pkey->references;
20 } 20 }
21 21
22 // A common test class to ensure that the store is flushed after 22 // A common test class to ensure that the store is flushed after
23 // each test. 23 // each test.
24 class OpenSSLClientKeyStoreTest : public ::testing::Test { 24 class OpenSSLClientKeyStoreTest : public ::testing::Test {
25 public: 25 public:
26 OpenSSLClientKeyStoreTest() 26 OpenSSLClientKeyStoreTest()
27 : store_(OpenSSLClientKeyStore::GetInstance()) { 27 : store_(OpenSSLClientKeyStore::GetInstance()) {
28 } 28 }
29 29
30 virtual ~OpenSSLClientKeyStoreTest() { 30 ~OpenSSLClientKeyStoreTest() override {
31 if (store_) 31 if (store_)
32 store_->Flush(); 32 store_->Flush();
33 } 33 }
34 34
35 protected: 35 protected:
36 OpenSSLClientKeyStore* store_; 36 OpenSSLClientKeyStore* store_;
37 }; 37 };
38 38
39 // Check that GetInstance() returns non-null 39 // Check that GetInstance() returns non-null
40 TEST_F(OpenSSLClientKeyStoreTest, GetInstance) { 40 TEST_F(OpenSSLClientKeyStoreTest, GetInstance) {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 EXPECT_EQ(fetch_key1.get(), priv_key1.get()); 161 EXPECT_EQ(fetch_key1.get(), priv_key1.get());
162 EXPECT_EQ(fetch_key2.get(), priv_key2.get()); 162 EXPECT_EQ(fetch_key2.get(), priv_key2.get());
163 163
164 EXPECT_EQ(3, EVP_PKEY_get_refcount(priv_key1.get())); 164 EXPECT_EQ(3, EVP_PKEY_get_refcount(priv_key1.get()));
165 EXPECT_EQ(3, EVP_PKEY_get_refcount(priv_key2.get())); 165 EXPECT_EQ(3, EVP_PKEY_get_refcount(priv_key2.get()));
166 } 166 }
167 167
168 } // namespace 168 } // namespace
169 } // namespace net 169 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_proxy_client_socket.cc ('k') | net/ssl/openssl_ssl_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698