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 <memory> | 5 #include <memory> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 8857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8868 std::string redirect_location; | 8868 std::string redirect_location; |
8869 EXPECT_TRUE(headers->EnumerateHeader(NULL, "Location", &redirect_location)); | 8869 EXPECT_TRUE(headers->EnumerateHeader(NULL, "Location", &redirect_location)); |
8870 EXPECT_EQ(hsts_https_url.spec(), redirect_location); | 8870 EXPECT_EQ(hsts_https_url.spec(), redirect_location); |
8871 | 8871 |
8872 std::string received_cors_header; | 8872 std::string received_cors_header; |
8873 EXPECT_TRUE(headers->EnumerateHeader(NULL, "Access-Control-Allow-Origin", | 8873 EXPECT_TRUE(headers->EnumerateHeader(NULL, "Access-Control-Allow-Origin", |
8874 &received_cors_header)); | 8874 &received_cors_header)); |
8875 EXPECT_EQ(kOriginHeaderValue, received_cors_header); | 8875 EXPECT_EQ(kOriginHeaderValue, received_cors_header); |
8876 } | 8876 } |
8877 | 8877 |
8878 // Test that DHE-only servers fail with the expected dedicated error code. | |
8879 TEST_F(HTTPSRequestTest, DHE) { | |
8880 SpawnedTestServer::SSLOptions ssl_options; | |
8881 ssl_options.key_exchanges = | |
8882 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_DHE_RSA; | |
8883 SpawnedTestServer test_server( | |
8884 SpawnedTestServer::TYPE_HTTPS, ssl_options, | |
8885 base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); | |
8886 ASSERT_TRUE(test_server.Start()); | |
8887 | |
8888 TestDelegate d; | |
8889 { | |
8890 std::unique_ptr<URLRequest> r(default_context_.CreateRequest( | |
8891 test_server.GetURL("/defaultresponse"), DEFAULT_PRIORITY, &d)); | |
8892 | |
8893 r->Start(); | |
8894 EXPECT_TRUE(r->is_pending()); | |
8895 | |
8896 base::RunLoop().Run(); | |
8897 | |
8898 EXPECT_EQ(1, d.response_started_count()); | |
8899 EXPECT_EQ(ERR_SSL_OBSOLETE_CIPHER, d.request_status()); | |
8900 } | |
8901 } | |
8902 | |
8903 namespace { | 8878 namespace { |
8904 | 8879 |
8905 class SSLClientAuthTestDelegate : public TestDelegate { | 8880 class SSLClientAuthTestDelegate : public TestDelegate { |
8906 public: | 8881 public: |
8907 SSLClientAuthTestDelegate() : on_certificate_requested_count_(0) { | 8882 SSLClientAuthTestDelegate() : on_certificate_requested_count_(0) { |
8908 } | 8883 } |
8909 void OnCertificateRequested(URLRequest* request, | 8884 void OnCertificateRequested(URLRequest* request, |
8910 SSLCertRequestInfo* cert_request_info) override { | 8885 SSLCertRequestInfo* cert_request_info) override { |
8911 on_certificate_requested_count_++; | 8886 on_certificate_requested_count_++; |
8912 base::MessageLoop::current()->QuitWhenIdle(); | 8887 base::MessageLoop::current()->QuitWhenIdle(); |
(...skipping 1839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10752 AddTestInterceptor()->set_main_intercept_job(std::move(job)); | 10727 AddTestInterceptor()->set_main_intercept_job(std::move(job)); |
10753 | 10728 |
10754 req->Start(); | 10729 req->Start(); |
10755 req->Cancel(); | 10730 req->Cancel(); |
10756 base::RunLoop().RunUntilIdle(); | 10731 base::RunLoop().RunUntilIdle(); |
10757 EXPECT_EQ(ERR_ABORTED, d.request_status()); | 10732 EXPECT_EQ(ERR_ABORTED, d.request_status()); |
10758 EXPECT_EQ(0, d.received_redirect_count()); | 10733 EXPECT_EQ(0, d.received_redirect_count()); |
10759 } | 10734 } |
10760 | 10735 |
10761 } // namespace net | 10736 } // namespace net |
OLD | NEW |