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

Side by Side Diff: net/socket/ssl_session_cache_openssl_unittest.cc

Issue 683113005: Update from chromium https://crrev.com/302282 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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/socket/ssl_session_cache_openssl.cc ('k') | net/socket/stream_listen_socket.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/socket/ssl_session_cache_openssl.h" 5 #include "net/socket/ssl_session_cache_openssl.h"
6 6
7 #include <openssl/ssl.h> 7 #include <openssl/ssl.h>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "crypto/openssl_util.h" 12 #include "crypto/openssl_util.h"
13 #include "crypto/scoped_openssl_types.h" 13 #include "crypto/scoped_openssl_types.h"
14 14
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 // This is an internal OpenSSL function that can be used to create a new 17 // This is an internal OpenSSL function that can be used to create a new
18 // session for an existing SSL object. This shall force a call to the 18 // session for an existing SSL object. This shall force a call to the
19 // 'generate_session_id' callback from the SSL's session context. 19 // 'generate_session_id' callback from the SSL's session context.
20 // |s| is the target SSL connection handle. 20 // |s| is the target SSL connection handle.
21 // |session| is non-0 to ask for the creation of a new session. If 0, 21 // |session| is non-0 to ask for the creation of a new session. If 0,
22 // this will set an empty session with no ID instead. 22 // this will set an empty session with no ID instead.
23 extern "C" int ssl_get_new_session(SSL* s, int session); 23 extern "C" OPENSSL_EXPORT int ssl_get_new_session(SSL* s, int session);
24 24
25 // This is an internal OpenSSL function which is used internally to add 25 // This is an internal OpenSSL function which is used internally to add
26 // a new session to the cache. It is normally triggered by a succesful 26 // a new session to the cache. It is normally triggered by a succesful
27 // connection. However, this unit test does not use the network at all. 27 // connection. However, this unit test does not use the network at all.
28 extern "C" void ssl_update_cache(SSL* s, int mode); 28 extern "C" OPENSSL_EXPORT void ssl_update_cache(SSL* s, int mode);
29 29
30 namespace net { 30 namespace net {
31 31
32 namespace { 32 namespace {
33 33
34 typedef crypto::ScopedOpenSSL<SSL, SSL_free>::Type ScopedSSL; 34 typedef crypto::ScopedOpenSSL<SSL, SSL_free>::Type ScopedSSL;
35 typedef crypto::ScopedOpenSSL<SSL_CTX, SSL_CTX_free>::Type ScopedSSL_CTX; 35 typedef crypto::ScopedOpenSSL<SSL_CTX, SSL_CTX_free>::Type ScopedSSL_CTX;
36 36
37 // Helper class used to associate arbitrary std::string keys with SSL objects. 37 // Helper class used to associate arbitrary std::string keys with SSL objects.
38 class SSLKeyHelper { 38 class SSLKeyHelper {
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 371
372 // Call SetSSLSession another time, this shall expire all sessions except 372 // Call SetSSLSession another time, this shall expire all sessions except
373 // the last one. 373 // the last one.
374 ScopedSSL bad_ssl(NewSSL("unknown-key")); 374 ScopedSSL bad_ssl(NewSSL("unknown-key"));
375 cache_.SetSSLSession(bad_ssl.get()); 375 cache_.SetSSLSession(bad_ssl.get());
376 bad_ssl.reset(NULL); 376 bad_ssl.reset(NULL);
377 EXPECT_EQ(1U, cache_.size()); 377 EXPECT_EQ(1U, cache_.size());
378 } 378 }
379 379
380 } // namespace net 380 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_session_cache_openssl.cc ('k') | net/socket/stream_listen_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698