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 3789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3800 default_context_.transport_security_state(); | 3800 default_context_.transport_security_state(); |
3801 bool sni_available = true; | 3801 bool sni_available = true; |
3802 TransportSecurityState::DomainState domain_state; | 3802 TransportSecurityState::DomainState domain_state; |
3803 EXPECT_TRUE(security_state->GetDomainState( | 3803 EXPECT_TRUE(security_state->GetDomainState( |
3804 TestServer::kLocalhost, sni_available, &domain_state)); | 3804 TestServer::kLocalhost, sni_available, &domain_state)); |
3805 EXPECT_EQ(TransportSecurityState::DomainState::MODE_FORCE_HTTPS, | 3805 EXPECT_EQ(TransportSecurityState::DomainState::MODE_FORCE_HTTPS, |
3806 domain_state.upgrade_mode); | 3806 domain_state.upgrade_mode); |
3807 EXPECT_FALSE(domain_state.include_subdomains); | 3807 EXPECT_FALSE(domain_state.include_subdomains); |
3808 } | 3808 } |
3809 | 3809 |
| 3810 TEST_F(URLRequestTestHTTP, ProcessSTSAndPKP) { |
| 3811 TestServer::SSLOptions ssl_options; |
| 3812 TestServer https_test_server( |
| 3813 TestServer::TYPE_HTTPS, |
| 3814 ssl_options, |
| 3815 base::FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest"))); |
| 3816 ASSERT_TRUE(https_test_server.Start()); |
| 3817 |
| 3818 TestDelegate d; |
| 3819 URLRequest request( |
| 3820 https_test_server.GetURL("files/hsts-and-hpkp-headers.html"), |
| 3821 &d, |
| 3822 &default_context_); |
| 3823 request.Start(); |
| 3824 MessageLoop::current()->Run(); |
| 3825 |
| 3826 // We should have set parameters from the first header, not the second. |
| 3827 TransportSecurityState* security_state = |
| 3828 default_context_.transport_security_state(); |
| 3829 bool sni_available = true; |
| 3830 TransportSecurityState::DomainState domain_state; |
| 3831 EXPECT_TRUE(security_state->GetDomainState( |
| 3832 TestServer::kLocalhost, sni_available, &domain_state)); |
| 3833 EXPECT_EQ(TransportSecurityState::DomainState::MODE_FORCE_HTTPS, |
| 3834 domain_state.upgrade_mode); |
| 3835 #if defined(OS_ANDROID) |
| 3836 // Android's CertVerifyProc does not (yet) handle pins. |
| 3837 #else |
| 3838 EXPECT_TRUE(domain_state.HasPublicKeyPins()); |
| 3839 #endif |
| 3840 EXPECT_NE(domain_state.upgrade_expiry, |
| 3841 domain_state.dynamic_spki_hashes_expiry); |
| 3842 |
| 3843 // TODO(palmer): In the (near) future, TransportSecurityState will have a |
| 3844 // storage model allowing us to have independent values for |
| 3845 // include_subdomains. At that time, extend this test. |
| 3846 //EXPECT_FALSE(domain_state.include_subdomains); |
| 3847 } |
| 3848 |
3810 TEST_F(URLRequestTestHTTP, ContentTypeNormalizationTest) { | 3849 TEST_F(URLRequestTestHTTP, ContentTypeNormalizationTest) { |
3811 ASSERT_TRUE(test_server_.Start()); | 3850 ASSERT_TRUE(test_server_.Start()); |
3812 | 3851 |
3813 TestDelegate d; | 3852 TestDelegate d; |
3814 URLRequest req(test_server_.GetURL( | 3853 URLRequest req(test_server_.GetURL( |
3815 "files/content-type-normalization.html"), &d, &default_context_); | 3854 "files/content-type-normalization.html"), &d, &default_context_); |
3816 req.Start(); | 3855 req.Start(); |
3817 MessageLoop::current()->Run(); | 3856 MessageLoop::current()->Run(); |
3818 | 3857 |
3819 std::string mime_type; | 3858 std::string mime_type; |
(...skipping 1892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5712 | 5751 |
5713 EXPECT_FALSE(r.is_pending()); | 5752 EXPECT_FALSE(r.is_pending()); |
5714 EXPECT_EQ(1, d->response_started_count()); | 5753 EXPECT_EQ(1, d->response_started_count()); |
5715 EXPECT_FALSE(d->received_data_before_response()); | 5754 EXPECT_FALSE(d->received_data_before_response()); |
5716 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); | 5755 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); |
5717 } | 5756 } |
5718 } | 5757 } |
5719 #endif // !defined(DISABLE_FTP_SUPPORT) | 5758 #endif // !defined(DISABLE_FTP_SUPPORT) |
5720 | 5759 |
5721 } // namespace net | 5760 } // namespace net |
OLD | NEW |