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

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

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/ssl_client_auth_cache.h" 5 #include "net/ssl/ssl_client_auth_cache.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "net/cert/x509_certificate.h" 8 #include "net/cert/x509_certificate.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace net { 11 namespace net {
12 12
13 TEST(SSLClientAuthCacheTest, LookupAddRemove) { 13 TEST(SSLClientAuthCacheTest, LookupAddRemove) {
14 SSLClientAuthCache cache; 14 SSLClientAuthCache cache;
15 15
16 base::Time start_date = base::Time::Now(); 16 base::Time start_date = base::Time::Now();
17 base::Time expiration_date = start_date + base::TimeDelta::FromDays(1); 17 base::Time expiration_date = start_date + base::TimeDelta::FromDays(1);
18 18
19 HostPortPair server1("foo1", 443); 19 HostPortPair server1("foo1", 443);
20 scoped_refptr<X509Certificate> cert1( 20 scoped_refptr<X509Certificate> cert1(
21 new X509Certificate("foo1", "CA", start_date, expiration_date)); 21 new X509Certificate("foo1", "CA", start_date, expiration_date));
22 22
23 HostPortPair server2("foo2", 443); 23 HostPortPair server2("foo2", 443);
24 scoped_refptr<X509Certificate> cert2( 24 scoped_refptr<X509Certificate> cert2(
25 new X509Certificate("foo2", "CA", start_date, expiration_date)); 25 new X509Certificate("foo2", "CA", start_date, expiration_date));
26 26
27 HostPortPair server3("foo3", 443); 27 HostPortPair server3("foo3", 443);
28 scoped_refptr<X509Certificate> cert3( 28 scoped_refptr<X509Certificate> cert3(
29 new X509Certificate("foo3", "CA", start_date, expiration_date)); 29 new X509Certificate("foo3", "CA", start_date, expiration_date));
30 30
31 scoped_refptr<X509Certificate> cached_cert; 31 scoped_refptr<X509Certificate> cached_cert;
32 // Lookup non-existent client certificate. 32 // Lookup non-existent client certificate.
33 cached_cert = NULL; 33 cached_cert = NULL;
34 EXPECT_FALSE(cache.Lookup(server1, &cached_cert)); 34 EXPECT_FALSE(cache.Lookup(server1, &cached_cert));
35 35
36 // Add client certificate for server1. 36 // Add client certificate for server1.
37 cache.Add(server1, cert1.get()); 37 cache.Add(server1, cert1.get());
38 cached_cert = NULL; 38 cached_cert = NULL;
39 EXPECT_TRUE(cache.Lookup(server1, &cached_cert)); 39 EXPECT_TRUE(cache.Lookup(server1, &cached_cert));
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 EXPECT_EQ(NULL, cached_cert.get()); 162 EXPECT_EQ(NULL, cached_cert.get());
163 163
164 cache.OnCertAdded(NULL); 164 cache.OnCertAdded(NULL);
165 165
166 // Check that we no longer have entries for either server. 166 // Check that we no longer have entries for either server.
167 EXPECT_FALSE(cache.Lookup(server1, &cached_cert)); 167 EXPECT_FALSE(cache.Lookup(server1, &cached_cert));
168 EXPECT_FALSE(cache.Lookup(server2, &cached_cert)); 168 EXPECT_FALSE(cache.Lookup(server2, &cached_cert));
169 } 169 }
170 170
171 } // namespace net 171 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698