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 8637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8648 std::string redirect_location; | 8648 std::string redirect_location; |
8649 EXPECT_TRUE(headers->EnumerateHeader(NULL, "Location", &redirect_location)); | 8649 EXPECT_TRUE(headers->EnumerateHeader(NULL, "Location", &redirect_location)); |
8650 EXPECT_EQ(hsts_https_url.spec(), redirect_location); | 8650 EXPECT_EQ(hsts_https_url.spec(), redirect_location); |
8651 | 8651 |
8652 std::string received_cors_header; | 8652 std::string received_cors_header; |
8653 EXPECT_TRUE(headers->EnumerateHeader(NULL, "Access-Control-Allow-Origin", | 8653 EXPECT_TRUE(headers->EnumerateHeader(NULL, "Access-Control-Allow-Origin", |
8654 &received_cors_header)); | 8654 &received_cors_header)); |
8655 EXPECT_EQ(kOriginHeaderValue, received_cors_header); | 8655 EXPECT_EQ(kOriginHeaderValue, received_cors_header); |
8656 } | 8656 } |
8657 | 8657 |
| 8658 // Test that DHE-only servers fail with the expected dedicated error code. |
| 8659 TEST_F(HTTPSRequestTest, DHE) { |
| 8660 SpawnedTestServer::SSLOptions ssl_options; |
| 8661 ssl_options.key_exchanges = |
| 8662 SpawnedTestServer::SSLOptions::KEY_EXCHANGE_DHE_RSA; |
| 8663 SpawnedTestServer test_server( |
| 8664 SpawnedTestServer::TYPE_HTTPS, ssl_options, |
| 8665 base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); |
| 8666 ASSERT_TRUE(test_server.Start()); |
| 8667 |
| 8668 TestDelegate d; |
| 8669 { |
| 8670 std::unique_ptr<URLRequest> r(default_context_.CreateRequest( |
| 8671 test_server.GetURL("/defaultresponse"), DEFAULT_PRIORITY, &d)); |
| 8672 |
| 8673 r->Start(); |
| 8674 EXPECT_TRUE(r->is_pending()); |
| 8675 |
| 8676 base::RunLoop().Run(); |
| 8677 |
| 8678 EXPECT_EQ(1, d.response_started_count()); |
| 8679 EXPECT_FALSE(r->status().is_success()); |
| 8680 EXPECT_EQ(URLRequestStatus::FAILED, r->status().status()); |
| 8681 EXPECT_EQ(ERR_SSL_OBSOLETE_CIPHER, r->status().error()); |
| 8682 } |
| 8683 } |
| 8684 |
8658 namespace { | 8685 namespace { |
8659 | 8686 |
8660 class SSLClientAuthTestDelegate : public TestDelegate { | 8687 class SSLClientAuthTestDelegate : public TestDelegate { |
8661 public: | 8688 public: |
8662 SSLClientAuthTestDelegate() : on_certificate_requested_count_(0) { | 8689 SSLClientAuthTestDelegate() : on_certificate_requested_count_(0) { |
8663 } | 8690 } |
8664 void OnCertificateRequested(URLRequest* request, | 8691 void OnCertificateRequested(URLRequest* request, |
8665 SSLCertRequestInfo* cert_request_info) override { | 8692 SSLCertRequestInfo* cert_request_info) override { |
8666 on_certificate_requested_count_++; | 8693 on_certificate_requested_count_++; |
8667 base::MessageLoop::current()->QuitWhenIdle(); | 8694 base::MessageLoop::current()->QuitWhenIdle(); |
(...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10148 AddTestInterceptor()->set_main_intercept_job(std::move(job)); | 10175 AddTestInterceptor()->set_main_intercept_job(std::move(job)); |
10149 | 10176 |
10150 req->Start(); | 10177 req->Start(); |
10151 req->Cancel(); | 10178 req->Cancel(); |
10152 base::RunLoop().RunUntilIdle(); | 10179 base::RunLoop().RunUntilIdle(); |
10153 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status()); | 10180 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status()); |
10154 EXPECT_EQ(0, d.received_redirect_count()); | 10181 EXPECT_EQ(0, d.received_redirect_count()); |
10155 } | 10182 } |
10156 | 10183 |
10157 } // namespace net | 10184 } // namespace net |
OLD | NEW |