| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #include "net/http/http_request_headers.h" | 49 #include "net/http/http_request_headers.h" |
| 50 #include "net/http/http_response_headers.h" | 50 #include "net/http/http_response_headers.h" |
| 51 #include "net/ocsp/nss_ocsp.h" | 51 #include "net/ocsp/nss_ocsp.h" |
| 52 #include "net/proxy/proxy_service.h" | 52 #include "net/proxy/proxy_service.h" |
| 53 #include "net/socket/ssl_client_socket.h" | 53 #include "net/socket/ssl_client_socket.h" |
| 54 #include "net/test/test_server.h" | 54 #include "net/test/test_server.h" |
| 55 #include "net/url_request/ftp_protocol_handler.h" | 55 #include "net/url_request/ftp_protocol_handler.h" |
| 56 #include "net/url_request/url_request.h" | 56 #include "net/url_request/url_request.h" |
| 57 #include "net/url_request/url_request_file_dir_job.h" | 57 #include "net/url_request/url_request_file_dir_job.h" |
| 58 #include "net/url_request/url_request_http_job.h" | 58 #include "net/url_request/url_request_http_job.h" |
| 59 #include "net/url_request/url_request_job_factory.h" | 59 #include "net/url_request/url_request_job_factory_impl.h" |
| 60 #include "net/url_request/url_request_redirect_job.h" | 60 #include "net/url_request/url_request_redirect_job.h" |
| 61 #include "net/url_request/url_request_test_job.h" | 61 #include "net/url_request/url_request_test_job.h" |
| 62 #include "net/url_request/url_request_test_util.h" | 62 #include "net/url_request/url_request_test_util.h" |
| 63 #include "testing/gtest/include/gtest/gtest.h" | 63 #include "testing/gtest/include/gtest/gtest.h" |
| 64 #include "testing/platform_test.h" | 64 #include "testing/platform_test.h" |
| 65 | 65 |
| 66 #if defined(OS_WIN) | 66 #if defined(OS_WIN) |
| 67 #include "base/win/windows_version.h" | 67 #include "base/win/windows_version.h" |
| 68 #endif | 68 #endif |
| 69 | 69 |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 // Adds the TestJobInterceptor to the default context. | 431 // Adds the TestJobInterceptor to the default context. |
| 432 TestJobInterceptor* AddTestInterceptor() { | 432 TestJobInterceptor* AddTestInterceptor() { |
| 433 TestJobInterceptor* interceptor = new TestJobInterceptor(); | 433 TestJobInterceptor* interceptor = new TestJobInterceptor(); |
| 434 default_context_.set_job_factory(&job_factory_); | 434 default_context_.set_job_factory(&job_factory_); |
| 435 job_factory_.AddInterceptor(interceptor); | 435 job_factory_.AddInterceptor(interceptor); |
| 436 return interceptor; | 436 return interceptor; |
| 437 } | 437 } |
| 438 | 438 |
| 439 protected: | 439 protected: |
| 440 TestNetworkDelegate default_network_delegate_; // must outlive URLRequest | 440 TestNetworkDelegate default_network_delegate_; // must outlive URLRequest |
| 441 URLRequestJobFactory job_factory_; | 441 URLRequestJobFactoryImpl job_factory_; |
| 442 TestURLRequestContext default_context_; | 442 TestURLRequestContext default_context_; |
| 443 }; | 443 }; |
| 444 | 444 |
| 445 class URLRequestTestHTTP : public URLRequestTest { | 445 class URLRequestTestHTTP : public URLRequestTest { |
| 446 public: | 446 public: |
| 447 URLRequestTestHTTP() | 447 URLRequestTestHTTP() |
| 448 : test_server_(FilePath(FILE_PATH_LITERAL( | 448 : test_server_(FilePath(FILE_PATH_LITERAL( |
| 449 "net/data/url_request_unittest"))) { | 449 "net/data/url_request_unittest"))) { |
| 450 } | 450 } |
| 451 | 451 |
| (...skipping 3709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4161 } | 4161 } |
| 4162 | 4162 |
| 4163 protected: | 4163 protected: |
| 4164 TestServer test_server_; | 4164 TestServer test_server_; |
| 4165 }; | 4165 }; |
| 4166 | 4166 |
| 4167 // Make sure an FTP request using an unsafe ports fails. | 4167 // Make sure an FTP request using an unsafe ports fails. |
| 4168 TEST_F(URLRequestTestFTP, UnsafePort) { | 4168 TEST_F(URLRequestTestFTP, UnsafePort) { |
| 4169 ASSERT_TRUE(test_server_.Start()); | 4169 ASSERT_TRUE(test_server_.Start()); |
| 4170 | 4170 |
| 4171 URLRequestJobFactory job_factory; | 4171 URLRequestJobFactoryImpl job_factory; |
| 4172 | 4172 |
| 4173 GURL url("ftp://127.0.0.1:7"); | 4173 GURL url("ftp://127.0.0.1:7"); |
| 4174 FtpProtocolHandler ftp_protocol_handler( | 4174 FtpProtocolHandler ftp_protocol_handler( |
| 4175 default_context_.ftp_transaction_factory(), | 4175 default_context_.ftp_transaction_factory(), |
| 4176 default_context_.ftp_auth_cache()); | 4176 default_context_.ftp_auth_cache()); |
| 4177 job_factory.SetProtocolHandler( | 4177 job_factory.SetProtocolHandler( |
| 4178 "ftp", | 4178 "ftp", |
| 4179 new FtpProtocolHandler(default_context_.ftp_transaction_factory(), | 4179 new FtpProtocolHandler(default_context_.ftp_transaction_factory(), |
| 4180 default_context_.ftp_auth_cache())); | 4180 default_context_.ftp_auth_cache())); |
| 4181 default_context_.set_job_factory(&job_factory); | 4181 default_context_.set_job_factory(&job_factory); |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4681 req.SetExtraRequestHeaders(headers); | 4681 req.SetExtraRequestHeaders(headers); |
| 4682 req.Start(); | 4682 req.Start(); |
| 4683 MessageLoop::current()->Run(); | 4683 MessageLoop::current()->Run(); |
| 4684 // If the net tests are being run with ChromeFrame then we need to allow for | 4684 // If the net tests are being run with ChromeFrame then we need to allow for |
| 4685 // the 'chromeframe' suffix which is added to the user agent before the | 4685 // the 'chromeframe' suffix which is added to the user agent before the |
| 4686 // closing parentheses. | 4686 // closing parentheses. |
| 4687 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true)); | 4687 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true)); |
| 4688 } | 4688 } |
| 4689 | 4689 |
| 4690 } // namespace net | 4690 } // namespace net |
| OLD | NEW |