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