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 7846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7857 if (err_allowed) { | 7857 if (err_allowed) { |
7858 EXPECT_NE(0, d.bytes_received()); | 7858 EXPECT_NE(0, d.bytes_received()); |
7859 CheckSSLInfo(r->ssl_info()); | 7859 CheckSSLInfo(r->ssl_info()); |
7860 } else { | 7860 } else { |
7861 EXPECT_EQ(0, d.bytes_received()); | 7861 EXPECT_EQ(0, d.bytes_received()); |
7862 } | 7862 } |
7863 } | 7863 } |
7864 } | 7864 } |
7865 } | 7865 } |
7866 | 7866 |
7867 // Tests that servers which require a deprecated cipher suite still work. | |
7868 TEST_F(HTTPSRequestTest, CipherFallbackTest) { | |
7869 TestNetLog net_log; | |
7870 default_context_.set_net_log(&net_log); | |
7871 | |
7872 SpawnedTestServer::SSLOptions ssl_options; | |
7873 ssl_options.bulk_ciphers = SpawnedTestServer::SSLOptions::BULK_CIPHER_RC4; | |
7874 SpawnedTestServer test_server( | |
7875 SpawnedTestServer::TYPE_HTTPS, ssl_options, | |
7876 base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); | |
7877 ASSERT_TRUE(test_server.Start()); | |
7878 | |
7879 TestDelegate d; | |
7880 scoped_ptr<URLRequest> r(default_context_.CreateRequest( | |
7881 test_server.GetURL(std::string()), DEFAULT_PRIORITY, &d)); | |
7882 r->Start(); | |
7883 EXPECT_TRUE(r->is_pending()); | |
7884 | |
7885 base::RunLoop().Run(); | |
7886 | |
7887 EXPECT_EQ(1, d.response_started_count()); | |
7888 EXPECT_FALSE(d.received_data_before_response()); | |
7889 EXPECT_NE(0, d.bytes_received()); | |
7890 CheckSSLInfo(r->ssl_info()); | |
7891 EXPECT_EQ(test_server.host_port_pair().host(), r->GetSocketAddress().host()); | |
7892 EXPECT_EQ(test_server.host_port_pair().port(), r->GetSocketAddress().port()); | |
7893 | |
7894 // No version downgrade should have been necessary. | |
7895 EXPECT_FALSE(r->ssl_info().connection_status & | |
7896 SSL_CONNECTION_VERSION_FALLBACK); | |
7897 EXPECT_EQ(SSL_CONNECTION_VERSION_TLS1_2, | |
7898 SSLConnectionStatusToVersion(r->ssl_info().connection_status)); | |
7899 | |
7900 TestNetLogEntry::List entries; | |
7901 net_log.GetEntries(&entries); | |
7902 ExpectLogContainsSomewhere(entries, 0, NetLog::TYPE_SSL_CIPHER_FALLBACK, | |
7903 NetLog::PHASE_NONE); | |
7904 } | |
7905 | |
7906 // This tests that a load of www.google.com with a certificate error sets | 7867 // This tests that a load of www.google.com with a certificate error sets |
7907 // the |certificate_errors_are_fatal| flag correctly. This flag will cause | 7868 // the |certificate_errors_are_fatal| flag correctly. This flag will cause |
7908 // the interstitial to be fatal. | 7869 // the interstitial to be fatal. |
7909 TEST_F(HTTPSRequestTest, HTTPSPreloadedHSTSTest) { | 7870 TEST_F(HTTPSRequestTest, HTTPSPreloadedHSTSTest) { |
7910 SpawnedTestServer::SSLOptions ssl_options( | 7871 SpawnedTestServer::SSLOptions ssl_options( |
7911 SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME); | 7872 SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME); |
7912 SpawnedTestServer test_server( | 7873 SpawnedTestServer test_server( |
7913 SpawnedTestServer::TYPE_HTTPS, | 7874 SpawnedTestServer::TYPE_HTTPS, |
7914 ssl_options, | 7875 ssl_options, |
7915 base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); | 7876 base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); |
(...skipping 1800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9716 | 9677 |
9717 req->Start(); | 9678 req->Start(); |
9718 req->Cancel(); | 9679 req->Cancel(); |
9719 job->DetachRequest(); | 9680 job->DetachRequest(); |
9720 base::RunLoop().RunUntilIdle(); | 9681 base::RunLoop().RunUntilIdle(); |
9721 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status()); | 9682 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status()); |
9722 EXPECT_EQ(0, d.received_redirect_count()); | 9683 EXPECT_EQ(0, d.received_redirect_count()); |
9723 } | 9684 } |
9724 | 9685 |
9725 } // namespace net | 9686 } // namespace net |
OLD | NEW |