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 "chrome/test/base/testing_profile.h" | 5 #include "chrome/test/base/testing_profile.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 } | 578 } |
579 | 579 |
580 DownloadManagerDelegate* TestingProfile::GetDownloadManagerDelegate() { | 580 DownloadManagerDelegate* TestingProfile::GetDownloadManagerDelegate() { |
581 return NULL; | 581 return NULL; |
582 } | 582 } |
583 | 583 |
584 net::URLRequestContextGetter* TestingProfile::GetRequestContext() { | 584 net::URLRequestContextGetter* TestingProfile::GetRequestContext() { |
585 return request_context_.get(); | 585 return request_context_.get(); |
586 } | 586 } |
587 | 587 |
| 588 net::URLRequestContextGetter* TestingProfile::CreateRequestContext( |
| 589 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 590 blob_protocol_handler, |
| 591 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 592 file_system_protocol_handler, |
| 593 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 594 developer_protocol_handler, |
| 595 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 596 chrome_protocol_handler, |
| 597 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 598 chrome_devtools_protocol_handler) { |
| 599 return request_context_.get(); |
| 600 } |
| 601 |
588 net::URLRequestContextGetter* TestingProfile::GetRequestContextForRenderProcess( | 602 net::URLRequestContextGetter* TestingProfile::GetRequestContextForRenderProcess( |
589 int renderer_child_id) { | 603 int renderer_child_id) { |
590 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( | 604 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
591 renderer_child_id); | 605 renderer_child_id); |
592 return rph->GetStoragePartition()->GetURLRequestContext(); | 606 return rph->GetStoragePartition()->GetURLRequestContext(); |
593 } | 607 } |
594 | 608 |
595 void TestingProfile::CreateRequestContext() { | 609 void TestingProfile::CreateRequestContext() { |
596 if (!request_context_) | 610 if (!request_context_) |
597 request_context_ = | 611 request_context_ = |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 return extensions_request_context_.get(); | 644 return extensions_request_context_.get(); |
631 } | 645 } |
632 | 646 |
633 net::SSLConfigService* TestingProfile::GetSSLConfigService() { | 647 net::SSLConfigService* TestingProfile::GetSSLConfigService() { |
634 if (!GetRequestContext()) | 648 if (!GetRequestContext()) |
635 return NULL; | 649 return NULL; |
636 return GetRequestContext()->GetURLRequestContext()->ssl_config_service(); | 650 return GetRequestContext()->GetURLRequestContext()->ssl_config_service(); |
637 } | 651 } |
638 | 652 |
639 net::URLRequestContextGetter* | 653 net::URLRequestContextGetter* |
640 TestingProfile::GetRequestContextForStoragePartition( | 654 TestingProfile::CreateRequestContextForStoragePartition( |
641 const FilePath& partition_path, | 655 const FilePath& partition_path, |
642 bool in_memory) { | 656 bool in_memory, |
| 657 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 658 blob_protocol_handler, |
| 659 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 660 file_system_protocol_handler, |
| 661 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 662 developer_protocol_handler, |
| 663 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 664 chrome_protocol_handler, |
| 665 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 666 chrome_devtools_protocol_handler) { |
643 // We don't test storage partitions here yet, so returning the same dummy | 667 // We don't test storage partitions here yet, so returning the same dummy |
644 // context is sufficient for now. | 668 // context is sufficient for now. |
645 return GetRequestContext(); | 669 return GetRequestContext(); |
646 } | 670 } |
647 | 671 |
648 content::ResourceContext* TestingProfile::GetResourceContext() { | 672 content::ResourceContext* TestingProfile::GetResourceContext() { |
649 if (!resource_context_.get()) | 673 if (!resource_context_.get()) |
650 resource_context_.reset(new content::MockResourceContext()); | 674 resource_context_.reset(new content::MockResourceContext()); |
651 return resource_context_.get(); | 675 return resource_context_.get(); |
652 } | 676 } |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { | 818 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { |
795 DCHECK(!build_called_); | 819 DCHECK(!build_called_); |
796 build_called_ = true; | 820 build_called_ = true; |
797 return scoped_ptr<TestingProfile>(new TestingProfile( | 821 return scoped_ptr<TestingProfile>(new TestingProfile( |
798 path_, | 822 path_, |
799 delegate_, | 823 delegate_, |
800 extension_policy_, | 824 extension_policy_, |
801 pref_service_.Pass(), | 825 pref_service_.Pass(), |
802 off_the_record_)); | 826 off_the_record_)); |
803 } | 827 } |
OLD | NEW |