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

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

Issue 4091005: Remove SSL 2.0 support. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Sync with ToT Created 10 years 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
« no previous file with comments | « net/base/ssl_config_service_win.cc ('k') | net/socket/ssl_client_socket_mac.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/ssl_config_service_win.h" 5 #include "net/base/ssl_config_service_win.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 using base::TimeDelta; 8 using base::TimeDelta;
9 using base::TimeTicks; 9 using base::TimeTicks;
10 10
(...skipping 21 matching lines...) Expand all
32 32
33 class SSLConfigServiceWinTest : public testing::Test { 33 class SSLConfigServiceWinTest : public testing::Test {
34 }; 34 };
35 35
36 } // namespace 36 } // namespace
37 37
38 TEST(SSLConfigServiceWinTest, GetNowTest) { 38 TEST(SSLConfigServiceWinTest, GetNowTest) {
39 // Verify that the constructor sets the correct default values. 39 // Verify that the constructor sets the correct default values.
40 net::SSLConfig config; 40 net::SSLConfig config;
41 EXPECT_EQ(true, config.rev_checking_enabled); 41 EXPECT_EQ(true, config.rev_checking_enabled);
42 EXPECT_EQ(false, config.ssl2_enabled);
43 EXPECT_EQ(true, config.ssl3_enabled); 42 EXPECT_EQ(true, config.ssl3_enabled);
44 EXPECT_EQ(true, config.tls1_enabled); 43 EXPECT_EQ(true, config.tls1_enabled);
45 44
46 bool rv = net::SSLConfigServiceWin::GetSSLConfigNow(&config); 45 bool rv = net::SSLConfigServiceWin::GetSSLConfigNow(&config);
47 EXPECT_TRUE(rv); 46 EXPECT_TRUE(rv);
48 } 47 }
49 48
50 TEST(SSLConfigServiceWinTest, SetTest) { 49 TEST(SSLConfigServiceWinTest, SetTest) {
51 // Save the current settings so we can restore them after the tests. 50 // Save the current settings so we can restore them after the tests.
52 net::SSLConfig config_save; 51 net::SSLConfig config_save;
53 bool rv = net::SSLConfigServiceWin::GetSSLConfigNow(&config_save); 52 bool rv = net::SSLConfigServiceWin::GetSSLConfigNow(&config_save);
54 EXPECT_TRUE(rv); 53 EXPECT_TRUE(rv);
55 54
56 net::SSLConfig config; 55 net::SSLConfig config;
57 56
58 // Test SetRevCheckingEnabled. 57 // Test SetRevCheckingEnabled.
59 net::SSLConfigServiceWin::SetRevCheckingEnabled(true); 58 net::SSLConfigServiceWin::SetRevCheckingEnabled(true);
60 rv = net::SSLConfigServiceWin::GetSSLConfigNow(&config); 59 rv = net::SSLConfigServiceWin::GetSSLConfigNow(&config);
61 EXPECT_TRUE(rv); 60 EXPECT_TRUE(rv);
62 EXPECT_TRUE(config.rev_checking_enabled); 61 EXPECT_TRUE(config.rev_checking_enabled);
63 62
64 net::SSLConfigServiceWin::SetRevCheckingEnabled(false); 63 net::SSLConfigServiceWin::SetRevCheckingEnabled(false);
65 rv = net::SSLConfigServiceWin::GetSSLConfigNow(&config); 64 rv = net::SSLConfigServiceWin::GetSSLConfigNow(&config);
66 EXPECT_TRUE(rv); 65 EXPECT_TRUE(rv);
67 EXPECT_FALSE(config.rev_checking_enabled); 66 EXPECT_FALSE(config.rev_checking_enabled);
68 67
69 net::SSLConfigServiceWin::SetRevCheckingEnabled( 68 net::SSLConfigServiceWin::SetRevCheckingEnabled(
70 config_save.rev_checking_enabled); 69 config_save.rev_checking_enabled);
71 70
72 // Test SetSSL2Enabled.
73 net::SSLConfigServiceWin::SetSSL2Enabled(true);
74 rv = net::SSLConfigServiceWin::GetSSLConfigNow(&config);
75 EXPECT_TRUE(rv);
76 EXPECT_TRUE(config.ssl2_enabled);
77
78 net::SSLConfigServiceWin::SetSSL2Enabled(false);
79 rv = net::SSLConfigServiceWin::GetSSLConfigNow(&config);
80 EXPECT_TRUE(rv);
81 EXPECT_FALSE(config.ssl2_enabled);
82
83 net::SSLConfigServiceWin::SetSSL2Enabled(config_save.ssl2_enabled);
84
85 // Test SetSSL3Enabled. 71 // Test SetSSL3Enabled.
86 net::SSLConfigServiceWin::SetSSL3Enabled(true); 72 net::SSLConfigServiceWin::SetSSL3Enabled(true);
87 rv = net::SSLConfigServiceWin::GetSSLConfigNow(&config); 73 rv = net::SSLConfigServiceWin::GetSSLConfigNow(&config);
74 EXPECT_TRUE(rv);
75 EXPECT_TRUE(config.ssl3_enabled);
76
77 net::SSLConfigServiceWin::SetSSL3Enabled(false);
78 rv = net::SSLConfigServiceWin::GetSSLConfigNow(&config);
79 EXPECT_TRUE(rv);
80 EXPECT_FALSE(config.ssl3_enabled);
81
82 net::SSLConfigServiceWin::SetSSL3Enabled(config_save.ssl3_enabled);
83
84 // Test SetTLS1Enabled.
85 net::SSLConfigServiceWin::SetTLS1Enabled(true);
86 rv = net::SSLConfigServiceWin::GetSSLConfigNow(&config);
87 EXPECT_TRUE(rv);
88 EXPECT_TRUE(config.tls1_enabled);
89
90 net::SSLConfigServiceWin::SetTLS1Enabled(false);
91 rv = net::SSLConfigServiceWin::GetSSLConfigNow(&config);
92 EXPECT_TRUE(rv);
93 EXPECT_FALSE(config.tls1_enabled);
94
95 net::SSLConfigServiceWin::SetTLS1Enabled(config_save.tls1_enabled);
96
97 // Test SetSSL3Enabled.
98 net::SSLConfigServiceWin::SetSSL3Enabled(true);
99 rv = net::SSLConfigServiceWin::GetSSLConfigNow(&config);
88 EXPECT_TRUE(rv); 100 EXPECT_TRUE(rv);
89 EXPECT_TRUE(config.ssl3_enabled); 101 EXPECT_TRUE(config.ssl3_enabled);
90 102
91 net::SSLConfigServiceWin::SetSSL3Enabled(false); 103 net::SSLConfigServiceWin::SetSSL3Enabled(false);
92 rv = net::SSLConfigServiceWin::GetSSLConfigNow(&config); 104 rv = net::SSLConfigServiceWin::GetSSLConfigNow(&config);
93 EXPECT_TRUE(rv); 105 EXPECT_TRUE(rv);
94 EXPECT_FALSE(config.ssl3_enabled); 106 EXPECT_FALSE(config.ssl3_enabled);
95 107
96 net::SSLConfigServiceWin::SetSSL3Enabled(config_save.ssl3_enabled); 108 net::SSLConfigServiceWin::SetSSL3Enabled(config_save.ssl3_enabled);
97 109
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 152
141 scoped_refptr<net::SSLConfigServiceWin> config_service( 153 scoped_refptr<net::SSLConfigServiceWin> config_service(
142 new net::SSLConfigServiceWin(now)); 154 new net::SSLConfigServiceWin(now));
143 155
144 // Save the current settings so we can restore them after the tests. 156 // Save the current settings so we can restore them after the tests.
145 net::SSLConfig config_save; 157 net::SSLConfig config_save;
146 bool rv = net::SSLConfigServiceWin::GetSSLConfigNow(&config_save); 158 bool rv = net::SSLConfigServiceWin::GetSSLConfigNow(&config_save);
147 EXPECT_TRUE(rv); 159 EXPECT_TRUE(rv);
148 160
149 net::SSLConfig config; 161 net::SSLConfig config;
150 net::SSLConfigServiceWin::SetSSL2Enabled(false); 162 net::SSLConfigServiceWin::SetSSL3Enabled(false);
151 config_service->GetSSLConfigAt(&config, now); 163 config_service->GetSSLConfigAt(&config, now);
152 164
153 // Add an observer. 165 // Add an observer.
154 SSLConfigServiceWinObserver observer; 166 SSLConfigServiceWinObserver observer;
155 config_service->AddObserver(&observer); 167 config_service->AddObserver(&observer);
156 168
157 // Toggle SSL2. 169 // Toggle SSL3.
158 net::SSLConfigServiceWin::SetSSL2Enabled(!config_save.ssl2_enabled); 170 net::SSLConfigServiceWin::SetSSL3Enabled(!config_save.ssl3_enabled);
159 config_service->GetSSLConfigAt(&config, later); 171 config_service->GetSSLConfigAt(&config, later);
160 172
161 // Verify that the observer was notified. 173 // Verify that the observer was notified.
162 EXPECT_TRUE(observer.change_was_observed()); 174 EXPECT_TRUE(observer.change_was_observed());
163 175
164 // Remove the observer. 176 // Remove the observer.
165 config_service->RemoveObserver(&observer); 177 config_service->RemoveObserver(&observer);
166 178
167 // Restore the original SSL2 setting. 179 // Restore the original SSL3 setting.
168 net::SSLConfigServiceWin::SetSSL2Enabled(config_save.ssl2_enabled); 180 net::SSLConfigServiceWin::SetSSL3Enabled(config_save.ssl3_enabled);
169 } 181 }
170 182
OLDNEW
« no previous file with comments | « net/base/ssl_config_service_win.cc ('k') | net/socket/ssl_client_socket_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698