| 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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 // Adds the TestJobInterceptor to the default context. | 428 // Adds the TestJobInterceptor to the default context. |
| 429 TestJobInterceptor* AddTestInterceptor() { | 429 TestJobInterceptor* AddTestInterceptor() { |
| 430 TestJobInterceptor* interceptor = new TestJobInterceptor(); | 430 TestJobInterceptor* interceptor = new TestJobInterceptor(); |
| 431 default_context_.set_job_factory(&job_factory_); | 431 default_context_.set_job_factory(&job_factory_); |
| 432 job_factory_.AddInterceptor(interceptor); | 432 job_factory_.AddInterceptor(interceptor); |
| 433 return interceptor; | 433 return interceptor; |
| 434 } | 434 } |
| 435 | 435 |
| 436 protected: | 436 protected: |
| 437 TestNetworkDelegate default_network_delegate_; // must outlive URLRequest | 437 TestNetworkDelegate default_network_delegate_; // must outlive URLRequest |
| 438 URLRequestJobFactory job_factory_; | 438 URLRequestJobFactoryImpl job_factory_; |
| 439 TestURLRequestContext default_context_; | 439 TestURLRequestContext default_context_; |
| 440 }; | 440 }; |
| 441 | 441 |
| 442 class URLRequestTestHTTP : public URLRequestTest { | 442 class URLRequestTestHTTP : public URLRequestTest { |
| 443 public: | 443 public: |
| 444 URLRequestTestHTTP() | 444 URLRequestTestHTTP() |
| 445 : test_server_(FilePath(FILE_PATH_LITERAL( | 445 : test_server_(FilePath(FILE_PATH_LITERAL( |
| 446 "net/data/url_request_unittest"))) { | 446 "net/data/url_request_unittest"))) { |
| 447 } | 447 } |
| 448 | 448 |
| (...skipping 3691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4140 } | 4140 } |
| 4141 | 4141 |
| 4142 protected: | 4142 protected: |
| 4143 TestServer test_server_; | 4143 TestServer test_server_; |
| 4144 }; | 4144 }; |
| 4145 | 4145 |
| 4146 // Make sure an FTP request using an unsafe ports fails. | 4146 // Make sure an FTP request using an unsafe ports fails. |
| 4147 TEST_F(URLRequestTestFTP, UnsafePort) { | 4147 TEST_F(URLRequestTestFTP, UnsafePort) { |
| 4148 ASSERT_TRUE(test_server_.Start()); | 4148 ASSERT_TRUE(test_server_.Start()); |
| 4149 | 4149 |
| 4150 URLRequestJobFactory job_factory; | 4150 URLRequestJobFactoryImpl job_factory; |
| 4151 | 4151 |
| 4152 GURL url("ftp://127.0.0.1:7"); | 4152 GURL url("ftp://127.0.0.1:7"); |
| 4153 FtpProtocolHandler ftp_protocol_handler( | 4153 FtpProtocolHandler ftp_protocol_handler( |
| 4154 default_context_.network_delegate(), | 4154 default_context_.network_delegate(), |
| 4155 default_context_.ftp_transaction_factory(), | 4155 default_context_.ftp_transaction_factory(), |
| 4156 default_context_.ftp_auth_cache()); | 4156 default_context_.ftp_auth_cache()); |
| 4157 job_factory.SetProtocolHandler( | 4157 job_factory.SetProtocolHandler( |
| 4158 "ftp", | 4158 "ftp", |
| 4159 new FtpProtocolHandler(default_context_.network_delegate(), | 4159 new FtpProtocolHandler(default_context_.network_delegate(), |
| 4160 default_context_.ftp_transaction_factory(), | 4160 default_context_.ftp_transaction_factory(), |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4662 req.SetExtraRequestHeaders(headers); | 4662 req.SetExtraRequestHeaders(headers); |
| 4663 req.Start(); | 4663 req.Start(); |
| 4664 MessageLoop::current()->Run(); | 4664 MessageLoop::current()->Run(); |
| 4665 // If the net tests are being run with ChromeFrame then we need to allow for | 4665 // If the net tests are being run with ChromeFrame then we need to allow for |
| 4666 // the 'chromeframe' suffix which is added to the user agent before the | 4666 // the 'chromeframe' suffix which is added to the user agent before the |
| 4667 // closing parentheses. | 4667 // closing parentheses. |
| 4668 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true)); | 4668 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true)); |
| 4669 } | 4669 } |
| 4670 | 4670 |
| 4671 } // namespace net | 4671 } // namespace net |
| OLD | NEW |