Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: net/url_request/url_request_unittest.cc

Issue 10836248: Turned job_factory into a pure virtual class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed includes Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 3657 matching lines...) Expand 10 before | Expand all | Expand 10 after
4106 } 4106 }
4107 4107
4108 protected: 4108 protected:
4109 TestServer test_server_; 4109 TestServer test_server_;
4110 }; 4110 };
4111 4111
4112 // Make sure an FTP request using an unsafe ports fails. 4112 // Make sure an FTP request using an unsafe ports fails.
4113 TEST_F(URLRequestTestFTP, UnsafePort) { 4113 TEST_F(URLRequestTestFTP, UnsafePort) {
4114 ASSERT_TRUE(test_server_.Start()); 4114 ASSERT_TRUE(test_server_.Start());
4115 4115
4116 URLRequestJobFactory job_factory; 4116 URLRequestJobFactoryImpl job_factory;
4117 4117
4118 GURL url("ftp://127.0.0.1:7"); 4118 GURL url("ftp://127.0.0.1:7");
4119 FtpProtocolHandler ftp_protocol_handler( 4119 FtpProtocolHandler ftp_protocol_handler(
4120 default_context_.network_delegate(), 4120 default_context_.network_delegate(),
4121 default_context_.ftp_transaction_factory(), 4121 default_context_.ftp_transaction_factory(),
4122 default_context_.ftp_auth_cache()); 4122 default_context_.ftp_auth_cache());
4123 job_factory.SetProtocolHandler( 4123 job_factory.SetProtocolHandler(
4124 "ftp", 4124 "ftp",
4125 new FtpProtocolHandler(default_context_.network_delegate(), 4125 new FtpProtocolHandler(default_context_.network_delegate(),
4126 default_context_.ftp_transaction_factory(), 4126 default_context_.ftp_transaction_factory(),
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
4628 req.SetExtraRequestHeaders(headers); 4628 req.SetExtraRequestHeaders(headers);
4629 req.Start(); 4629 req.Start();
4630 MessageLoop::current()->Run(); 4630 MessageLoop::current()->Run();
4631 // If the net tests are being run with ChromeFrame then we need to allow for 4631 // If the net tests are being run with ChromeFrame then we need to allow for
4632 // the 'chromeframe' suffix which is added to the user agent before the 4632 // the 'chromeframe' suffix which is added to the user agent before the
4633 // closing parentheses. 4633 // closing parentheses.
4634 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true)); 4634 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true));
4635 } 4635 }
4636 4636
4637 } // namespace net 4637 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698