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

Side by Side Diff: net/url_request/url_request_unittest.cc

Issue 1052743003: Move RC4 behind a fallback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make test not a no-op Created 5 years, 8 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
OLDNEW
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 7115 matching lines...) Expand 10 before | Expand all | Expand 10 after
7126 if (err_allowed) { 7126 if (err_allowed) {
7127 EXPECT_NE(0, d.bytes_received()); 7127 EXPECT_NE(0, d.bytes_received());
7128 CheckSSLInfo(r->ssl_info()); 7128 CheckSSLInfo(r->ssl_info());
7129 } else { 7129 } else {
7130 EXPECT_EQ(0, d.bytes_received()); 7130 EXPECT_EQ(0, d.bytes_received());
7131 } 7131 }
7132 } 7132 }
7133 } 7133 }
7134 } 7134 }
7135 7135
7136 // Tests that servers which require a deprecated cipher suite still work.
7137 TEST_F(HTTPSRequestTest, CipherFallbackTest) {
7138 CapturingNetLog net_log;
7139 default_context_.set_net_log(&net_log);
7140
7141 SpawnedTestServer::SSLOptions ssl_options;
7142 ssl_options.bulk_ciphers = SpawnedTestServer::SSLOptions::BULK_CIPHER_RC4;
7143 SpawnedTestServer test_server(
7144 SpawnedTestServer::TYPE_HTTPS, ssl_options,
7145 base::FilePath(FILE_PATH_LITERAL("net/data/ssl")));
7146 ASSERT_TRUE(test_server.Start());
7147
7148 TestDelegate d;
7149 {
Ryan Sleevi 2015/04/02 06:32:06 Is this scope necessary? Seems like a normal scopi
davidben 2015/04/03 19:58:26 Done. (Copy-paste from elsewhere.)
7150 scoped_ptr<URLRequest> r(default_context_.CreateRequest(
7151 test_server.GetURL(std::string()), DEFAULT_PRIORITY, &d));
7152 r->Start();
7153 EXPECT_TRUE(r->is_pending());
7154
7155 base::RunLoop().Run();
7156
7157 EXPECT_EQ(1, d.response_started_count());
7158 EXPECT_FALSE(d.received_data_before_response());
7159 EXPECT_NE(0, d.bytes_received());
7160 CheckSSLInfo(r->ssl_info());
7161 EXPECT_EQ(test_server.host_port_pair().host(),
7162 r->GetSocketAddress().host());
7163 EXPECT_EQ(test_server.host_port_pair().port(),
7164 r->GetSocketAddress().port());
7165
7166 // No version downgrade should have been necessary.
7167 EXPECT_FALSE(r->ssl_info().connection_status &
7168 SSL_CONNECTION_VERSION_FALLBACK);
7169 int expected_version = SSL_CONNECTION_VERSION_TLS1_2;
7170 if (SSLClientSocket::GetMaxSupportedSSLVersion() <
7171 SSL_PROTOCOL_VERSION_TLS1_2) {
7172 expected_version = SSL_CONNECTION_VERSION_TLS1_1;
7173 }
7174 EXPECT_EQ(expected_version,
7175 SSLConnectionStatusToVersion(r->ssl_info().connection_status));
7176
7177 CapturingNetLog::CapturedEntryList entries;
7178 net_log.GetEntries(&entries);
7179 ExpectLogContainsSomewhere(entries, 0, NetLog::TYPE_SSL_CIPHER_FALLBACK,
7180 NetLog::PHASE_NONE);
7181 }
7182 }
7183
7136 // This tests that a load of www.google.com with a certificate error sets 7184 // This tests that a load of www.google.com with a certificate error sets
7137 // the |certificate_errors_are_fatal| flag correctly. This flag will cause 7185 // the |certificate_errors_are_fatal| flag correctly. This flag will cause
7138 // the interstitial to be fatal. 7186 // the interstitial to be fatal.
7139 TEST_F(HTTPSRequestTest, HTTPSPreloadedHSTSTest) { 7187 TEST_F(HTTPSRequestTest, HTTPSPreloadedHSTSTest) {
7140 SpawnedTestServer::SSLOptions ssl_options( 7188 SpawnedTestServer::SSLOptions ssl_options(
7141 SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME); 7189 SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME);
7142 SpawnedTestServer test_server( 7190 SpawnedTestServer test_server(
7143 SpawnedTestServer::TYPE_HTTPS, 7191 SpawnedTestServer::TYPE_HTTPS,
7144 ssl_options, 7192 ssl_options,
7145 base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); 7193 base::FilePath(FILE_PATH_LITERAL("net/data/ssl")));
(...skipping 1793 matching lines...) Expand 10 before | Expand all | Expand 10 after
8939 8987
8940 EXPECT_FALSE(r->is_pending()); 8988 EXPECT_FALSE(r->is_pending());
8941 EXPECT_EQ(1, d->response_started_count()); 8989 EXPECT_EQ(1, d->response_started_count());
8942 EXPECT_FALSE(d->received_data_before_response()); 8990 EXPECT_FALSE(d->received_data_before_response());
8943 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); 8991 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size));
8944 } 8992 }
8945 } 8993 }
8946 #endif // !defined(DISABLE_FTP_SUPPORT) 8994 #endif // !defined(DISABLE_FTP_SUPPORT)
8947 8995
8948 } // namespace net 8996 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698