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 2113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2124 EXPECT_EQ(URLRequestStatus::FAILED, r.status().status()); | 2124 EXPECT_EQ(URLRequestStatus::FAILED, r.status().status()); |
2125 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, r.status().error()); | 2125 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, r.status().error()); |
2126 EXPECT_EQ(1, d.response_started_count()); | 2126 EXPECT_EQ(1, d.response_started_count()); |
2127 // We should not have followed the redirect. | 2127 // We should not have followed the redirect. |
2128 EXPECT_EQ(0, d.received_redirect_count()); | 2128 EXPECT_EQ(0, d.received_redirect_count()); |
2129 } | 2129 } |
2130 } | 2130 } |
2131 | 2131 |
2132 // This is the same as the previous test, but checks that the network delegate | 2132 // This is the same as the previous test, but checks that the network delegate |
2133 // registers the error. | 2133 // registers the error. |
2134 // This test was disabled because it made chrome_frame_net_tests hang | 2134 TEST_F(URLRequestTestHTTP, NetworkDelegateTunnelConnectionFailed) { |
2135 // (see bug 102991). | |
2136 TEST_F(URLRequestTestHTTP, DISABLED_NetworkDelegateTunnelConnectionFailed) { | |
2137 ASSERT_TRUE(test_server_.Start()); | 2135 ASSERT_TRUE(test_server_.Start()); |
2138 | 2136 |
2139 TestNetworkDelegate network_delegate; // Must outlive URLRequest. | 2137 TestNetworkDelegate network_delegate; // Must outlive URLRequest. |
2140 TestURLRequestContextWithProxy context( | 2138 TestURLRequestContextWithProxy context( |
2141 test_server_.host_port_pair().ToString(), | 2139 test_server_.host_port_pair().ToString(), |
2142 &network_delegate); | 2140 &network_delegate); |
2143 | 2141 |
2144 TestDelegate d; | 2142 TestDelegate d; |
2145 { | 2143 { |
2146 URLRequest r(GURL("https://www.redirect.com/"), &d, &context); | 2144 URLRequest r(GURL("https://www.redirect.com/"), &d, &context); |
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2935 << " Parameter = \"" << test_file << "\""; | 2933 << " Parameter = \"" << test_file << "\""; |
2936 } else { | 2934 } else { |
2937 EXPECT_EQ(URLRequestStatus::FAILED, r.status().status()); | 2935 EXPECT_EQ(URLRequestStatus::FAILED, r.status().status()); |
2938 EXPECT_EQ(ERR_CONTENT_LENGTH_MISMATCH, r.status().error()) | 2936 EXPECT_EQ(ERR_CONTENT_LENGTH_MISMATCH, r.status().error()) |
2939 << " Parameter = \"" << test_file << "\""; | 2937 << " Parameter = \"" << test_file << "\""; |
2940 } | 2938 } |
2941 } | 2939 } |
2942 } | 2940 } |
2943 } | 2941 } |
2944 | 2942 |
2945 // This test was disabled because it made chrome_frame_net_tests hang | 2943 TEST_F(URLRequestTestHTTP, HTTPSToHTTPRedirectNoRefererTest) { |
2946 // (see bug 102991). | |
2947 TEST_F(URLRequestTestHTTP, DISABLED_HTTPSToHTTPRedirectNoRefererTest) { | |
2948 ASSERT_TRUE(test_server_.Start()); | 2944 ASSERT_TRUE(test_server_.Start()); |
2949 | 2945 |
2950 TestServer https_test_server( | 2946 TestServer https_test_server( |
2951 TestServer::TYPE_HTTPS, TestServer::kLocalhost, | 2947 TestServer::TYPE_HTTPS, TestServer::kLocalhost, |
2952 base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); | 2948 base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); |
2953 ASSERT_TRUE(https_test_server.Start()); | 2949 ASSERT_TRUE(https_test_server.Start()); |
2954 | 2950 |
2955 // An https server is sent a request with an https referer, | 2951 // An https server is sent a request with an https referer, |
2956 // and responds with a redirect to an http url. The http | 2952 // and responds with a redirect to an http url. The http |
2957 // server should not be sent the referer. | 2953 // server should not be sent the referer. |
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4134 default_context_.set_network_delegate(&default_network_delegate_); | 4130 default_context_.set_network_delegate(&default_network_delegate_); |
4135 default_context_.Init(); | 4131 default_context_.Init(); |
4136 } | 4132 } |
4137 virtual ~HTTPSRequestTest() {} | 4133 virtual ~HTTPSRequestTest() {} |
4138 | 4134 |
4139 protected: | 4135 protected: |
4140 TestNetworkDelegate default_network_delegate_; // Must outlive URLRequest. | 4136 TestNetworkDelegate default_network_delegate_; // Must outlive URLRequest. |
4141 TestURLRequestContext default_context_; | 4137 TestURLRequestContext default_context_; |
4142 }; | 4138 }; |
4143 | 4139 |
4144 // This test was disabled because it made chrome_frame_net_tests hang | 4140 TEST_F(HTTPSRequestTest, HTTPSGetTest) { |
4145 // (see bug 102991). | |
4146 TEST_F(HTTPSRequestTest, DISABLED_HTTPSGetTest) { | |
4147 TestServer test_server(TestServer::TYPE_HTTPS, | 4141 TestServer test_server(TestServer::TYPE_HTTPS, |
4148 TestServer::kLocalhost, | 4142 TestServer::kLocalhost, |
4149 base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); | 4143 base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); |
4150 ASSERT_TRUE(test_server.Start()); | 4144 ASSERT_TRUE(test_server.Start()); |
4151 | 4145 |
4152 TestDelegate d; | 4146 TestDelegate d; |
4153 { | 4147 { |
4154 URLRequest r(test_server.GetURL(""), &d, &default_context_); | 4148 URLRequest r(test_server.GetURL(""), &d, &default_context_); |
4155 r.Start(); | 4149 r.Start(); |
4156 EXPECT_TRUE(r.is_pending()); | 4150 EXPECT_TRUE(r.is_pending()); |
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5367 | 5361 |
5368 EXPECT_FALSE(r.is_pending()); | 5362 EXPECT_FALSE(r.is_pending()); |
5369 EXPECT_EQ(1, d->response_started_count()); | 5363 EXPECT_EQ(1, d->response_started_count()); |
5370 EXPECT_FALSE(d->received_data_before_response()); | 5364 EXPECT_FALSE(d->received_data_before_response()); |
5371 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); | 5365 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); |
5372 } | 5366 } |
5373 } | 5367 } |
5374 #endif // !defined(DISABLE_FTP_SUPPORT) | 5368 #endif // !defined(DISABLE_FTP_SUPPORT) |
5375 | 5369 |
5376 } // namespace net | 5370 } // namespace net |
OLD | NEW |