OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shlobj.h> | 9 #include <shlobj.h> |
10 #endif | 10 #endif |
(...skipping 7178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7189 if (err_allowed) { | 7189 if (err_allowed) { |
7190 EXPECT_NE(0, d.bytes_received()); | 7190 EXPECT_NE(0, d.bytes_received()); |
7191 CheckSSLInfo(r->ssl_info()); | 7191 CheckSSLInfo(r->ssl_info()); |
7192 } else { | 7192 } else { |
7193 EXPECT_EQ(0, d.bytes_received()); | 7193 EXPECT_EQ(0, d.bytes_received()); |
7194 } | 7194 } |
7195 } | 7195 } |
7196 } | 7196 } |
7197 } | 7197 } |
7198 | 7198 |
| 7199 // Tests that servers which require a deprecated cipher suite still work. |
| 7200 TEST_F(HTTPSRequestTest, CipherFallbackTest) { |
| 7201 CapturingNetLog net_log; |
| 7202 default_context_.set_net_log(&net_log); |
| 7203 |
| 7204 SpawnedTestServer::SSLOptions ssl_options; |
| 7205 ssl_options.bulk_ciphers = SpawnedTestServer::SSLOptions::BULK_CIPHER_RC4; |
| 7206 SpawnedTestServer test_server( |
| 7207 SpawnedTestServer::TYPE_HTTPS, ssl_options, |
| 7208 base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); |
| 7209 ASSERT_TRUE(test_server.Start()); |
| 7210 |
| 7211 TestDelegate d; |
| 7212 scoped_ptr<URLRequest> r(default_context_.CreateRequest( |
| 7213 test_server.GetURL(std::string()), DEFAULT_PRIORITY, &d)); |
| 7214 r->Start(); |
| 7215 EXPECT_TRUE(r->is_pending()); |
| 7216 |
| 7217 base::RunLoop().Run(); |
| 7218 |
| 7219 EXPECT_EQ(1, d.response_started_count()); |
| 7220 EXPECT_FALSE(d.received_data_before_response()); |
| 7221 EXPECT_NE(0, d.bytes_received()); |
| 7222 CheckSSLInfo(r->ssl_info()); |
| 7223 EXPECT_EQ(test_server.host_port_pair().host(), r->GetSocketAddress().host()); |
| 7224 EXPECT_EQ(test_server.host_port_pair().port(), r->GetSocketAddress().port()); |
| 7225 |
| 7226 // No version downgrade should have been necessary. |
| 7227 EXPECT_FALSE(r->ssl_info().connection_status & |
| 7228 SSL_CONNECTION_VERSION_FALLBACK); |
| 7229 int expected_version = SSL_CONNECTION_VERSION_TLS1_2; |
| 7230 if (SSLClientSocket::GetMaxSupportedSSLVersion() < |
| 7231 SSL_PROTOCOL_VERSION_TLS1_2) { |
| 7232 expected_version = SSL_CONNECTION_VERSION_TLS1_1; |
| 7233 } |
| 7234 EXPECT_EQ(expected_version, |
| 7235 SSLConnectionStatusToVersion(r->ssl_info().connection_status)); |
| 7236 |
| 7237 CapturingNetLog::CapturedEntryList entries; |
| 7238 net_log.GetEntries(&entries); |
| 7239 ExpectLogContainsSomewhere(entries, 0, NetLog::TYPE_SSL_CIPHER_FALLBACK, |
| 7240 NetLog::PHASE_NONE); |
| 7241 } |
| 7242 |
7199 // This tests that a load of www.google.com with a certificate error sets | 7243 // This tests that a load of www.google.com with a certificate error sets |
7200 // the |certificate_errors_are_fatal| flag correctly. This flag will cause | 7244 // the |certificate_errors_are_fatal| flag correctly. This flag will cause |
7201 // the interstitial to be fatal. | 7245 // the interstitial to be fatal. |
7202 TEST_F(HTTPSRequestTest, HTTPSPreloadedHSTSTest) { | 7246 TEST_F(HTTPSRequestTest, HTTPSPreloadedHSTSTest) { |
7203 SpawnedTestServer::SSLOptions ssl_options( | 7247 SpawnedTestServer::SSLOptions ssl_options( |
7204 SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME); | 7248 SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME); |
7205 SpawnedTestServer test_server( | 7249 SpawnedTestServer test_server( |
7206 SpawnedTestServer::TYPE_HTTPS, | 7250 SpawnedTestServer::TYPE_HTTPS, |
7207 ssl_options, | 7251 ssl_options, |
7208 base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); | 7252 base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); |
(...skipping 1793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9002 | 9046 |
9003 EXPECT_FALSE(r->is_pending()); | 9047 EXPECT_FALSE(r->is_pending()); |
9004 EXPECT_EQ(1, d->response_started_count()); | 9048 EXPECT_EQ(1, d->response_started_count()); |
9005 EXPECT_FALSE(d->received_data_before_response()); | 9049 EXPECT_FALSE(d->received_data_before_response()); |
9006 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); | 9050 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); |
9007 } | 9051 } |
9008 } | 9052 } |
9009 #endif // !defined(DISABLE_FTP_SUPPORT) | 9053 #endif // !defined(DISABLE_FTP_SUPPORT) |
9010 | 9054 |
9011 } // namespace net | 9055 } // namespace net |
OLD | NEW |