OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <shlobj.h> | 8 #include <shlobj.h> |
9 #include <windows.h> | 9 #include <windows.h> |
10 #endif | 10 #endif |
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1075 if (err_allowed) { | 1075 if (err_allowed) { |
1076 EXPECT_NE(0, d.bytes_received()); | 1076 EXPECT_NE(0, d.bytes_received()); |
1077 CheckSSLInfo(r.ssl_info()); | 1077 CheckSSLInfo(r.ssl_info()); |
1078 } else { | 1078 } else { |
1079 EXPECT_EQ(0, d.bytes_received()); | 1079 EXPECT_EQ(0, d.bytes_received()); |
1080 } | 1080 } |
1081 } | 1081 } |
1082 } | 1082 } |
1083 } | 1083 } |
1084 | 1084 |
1085 // This tests that a load of www.google.com with a certificate error sets the | 1085 // This tests that a load of www.google.com with a certificate error sets |
1086 // is_hsts_host flag correctly. This flag will cause the interstitial to be | 1086 // the |certificate_errors_are_fatal| flag correctly. This flag will cause |
1087 // fatal. | 1087 // the interstitial to be fatal. |
1088 TEST_F(HTTPSRequestTest, HTTPSPreloadedHSTSTest) { | 1088 TEST_F(HTTPSRequestTest, HTTPSPreloadedHSTSTest) { |
1089 TestServer::HTTPSOptions https_options( | 1089 TestServer::HTTPSOptions https_options( |
1090 TestServer::HTTPSOptions::CERT_MISMATCHED_NAME); | 1090 TestServer::HTTPSOptions::CERT_MISMATCHED_NAME); |
1091 TestServer test_server(https_options, | 1091 TestServer test_server(https_options, |
1092 FilePath(FILE_PATH_LITERAL("net/data/ssl"))); | 1092 FilePath(FILE_PATH_LITERAL("net/data/ssl"))); |
1093 ASSERT_TRUE(test_server.Start()); | 1093 ASSERT_TRUE(test_server.Start()); |
1094 | 1094 |
1095 // We require that the URL be www.google.com in order to pick up the | 1095 // We require that the URL be www.google.com in order to pick up the |
1096 // preloaded HSTS entries in the TransportSecurityState. This means that we | 1096 // preloaded HSTS entries in the TransportSecurityState. This means that we |
1097 // have to use a MockHostResolver in order to direct www.google.com to the | 1097 // have to use a MockHostResolver in order to direct www.google.com to the |
(...skipping 16 matching lines...) Expand all Loading... |
1114 r.set_context(context); | 1114 r.set_context(context); |
1115 | 1115 |
1116 r.Start(); | 1116 r.Start(); |
1117 EXPECT_TRUE(r.is_pending()); | 1117 EXPECT_TRUE(r.is_pending()); |
1118 | 1118 |
1119 MessageLoop::current()->Run(); | 1119 MessageLoop::current()->Run(); |
1120 | 1120 |
1121 EXPECT_EQ(1, d.response_started_count()); | 1121 EXPECT_EQ(1, d.response_started_count()); |
1122 EXPECT_FALSE(d.received_data_before_response()); | 1122 EXPECT_FALSE(d.received_data_before_response()); |
1123 EXPECT_TRUE(d.have_certificate_errors()); | 1123 EXPECT_TRUE(d.have_certificate_errors()); |
1124 EXPECT_TRUE(d.is_hsts_host()); | 1124 EXPECT_TRUE(d.certificate_errors_are_fatal()); |
1125 } | 1125 } |
1126 | 1126 |
1127 namespace { | 1127 namespace { |
1128 | 1128 |
1129 class SSLClientAuthTestDelegate : public TestDelegate { | 1129 class SSLClientAuthTestDelegate : public TestDelegate { |
1130 public: | 1130 public: |
1131 SSLClientAuthTestDelegate() : on_certificate_requested_count_(0) { | 1131 SSLClientAuthTestDelegate() : on_certificate_requested_count_(0) { |
1132 } | 1132 } |
1133 virtual void OnCertificateRequested( | 1133 virtual void OnCertificateRequested( |
1134 URLRequest* request, | 1134 URLRequest* request, |
(...skipping 2684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3819 req.SetExtraRequestHeaders(headers); | 3819 req.SetExtraRequestHeaders(headers); |
3820 req.Start(); | 3820 req.Start(); |
3821 MessageLoop::current()->Run(); | 3821 MessageLoop::current()->Run(); |
3822 // If the net tests are being run with ChromeFrame then we need to allow for | 3822 // If the net tests are being run with ChromeFrame then we need to allow for |
3823 // the 'chromeframe' suffix which is added to the user agent before the | 3823 // the 'chromeframe' suffix which is added to the user agent before the |
3824 // closing parentheses. | 3824 // closing parentheses. |
3825 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true)); | 3825 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true)); |
3826 } | 3826 } |
3827 | 3827 |
3828 } // namespace net | 3828 } // namespace net |
OLD | NEW |