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