| 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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 | 584 |
| 585 DownloadManagerDelegate* TestingProfile::GetDownloadManagerDelegate() { | 585 DownloadManagerDelegate* TestingProfile::GetDownloadManagerDelegate() { |
| 586 return NULL; | 586 return NULL; |
| 587 } | 587 } |
| 588 | 588 |
| 589 net::URLRequestContextGetter* TestingProfile::GetRequestContext() { | 589 net::URLRequestContextGetter* TestingProfile::GetRequestContext() { |
| 590 return request_context_.get(); | 590 return request_context_.get(); |
| 591 } | 591 } |
| 592 | 592 |
| 593 net::URLRequestContextGetter* TestingProfile::CreateRequestContext( | 593 net::URLRequestContextGetter* TestingProfile::CreateRequestContext( |
| 594 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 594 content::ProtocolHandlerMap* protocol_handlers) { |
| 595 blob_protocol_handler, | |
| 596 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 597 file_system_protocol_handler, | |
| 598 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 599 developer_protocol_handler, | |
| 600 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 601 chrome_protocol_handler, | |
| 602 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 603 chrome_devtools_protocol_handler) { | |
| 604 return request_context_.get(); | 595 return request_context_.get(); |
| 605 } | 596 } |
| 606 | 597 |
| 607 net::URLRequestContextGetter* TestingProfile::GetRequestContextForRenderProcess( | 598 net::URLRequestContextGetter* TestingProfile::GetRequestContextForRenderProcess( |
| 608 int renderer_child_id) { | 599 int renderer_child_id) { |
| 609 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( | 600 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
| 610 renderer_child_id); | 601 renderer_child_id); |
| 611 return rph->GetStoragePartition()->GetURLRequestContext(); | 602 return rph->GetStoragePartition()->GetURLRequestContext(); |
| 612 } | 603 } |
| 613 | 604 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 net::SSLConfigService* TestingProfile::GetSSLConfigService() { | 643 net::SSLConfigService* TestingProfile::GetSSLConfigService() { |
| 653 if (!GetRequestContext()) | 644 if (!GetRequestContext()) |
| 654 return NULL; | 645 return NULL; |
| 655 return GetRequestContext()->GetURLRequestContext()->ssl_config_service(); | 646 return GetRequestContext()->GetURLRequestContext()->ssl_config_service(); |
| 656 } | 647 } |
| 657 | 648 |
| 658 net::URLRequestContextGetter* | 649 net::URLRequestContextGetter* |
| 659 TestingProfile::CreateRequestContextForStoragePartition( | 650 TestingProfile::CreateRequestContextForStoragePartition( |
| 660 const base::FilePath& partition_path, | 651 const base::FilePath& partition_path, |
| 661 bool in_memory, | 652 bool in_memory, |
| 662 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 653 content::ProtocolHandlerMap* protocol_handlers) { |
| 663 blob_protocol_handler, | |
| 664 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 665 file_system_protocol_handler, | |
| 666 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 667 developer_protocol_handler, | |
| 668 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 669 chrome_protocol_handler, | |
| 670 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 671 chrome_devtools_protocol_handler) { | |
| 672 // We don't test storage partitions here yet, so returning the same dummy | 654 // We don't test storage partitions here yet, so returning the same dummy |
| 673 // context is sufficient for now. | 655 // context is sufficient for now. |
| 674 return GetRequestContext(); | 656 return GetRequestContext(); |
| 675 } | 657 } |
| 676 | 658 |
| 677 content::ResourceContext* TestingProfile::GetResourceContext() { | 659 content::ResourceContext* TestingProfile::GetResourceContext() { |
| 678 if (!resource_context_.get()) | 660 if (!resource_context_.get()) |
| 679 resource_context_.reset(new content::MockResourceContext()); | 661 resource_context_.reset(new content::MockResourceContext()); |
| 680 return resource_context_.get(); | 662 return resource_context_.get(); |
| 681 } | 663 } |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 | 799 |
| 818 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { | 800 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { |
| 819 DCHECK(!build_called_); | 801 DCHECK(!build_called_); |
| 820 build_called_ = true; | 802 build_called_ = true; |
| 821 return scoped_ptr<TestingProfile>(new TestingProfile( | 803 return scoped_ptr<TestingProfile>(new TestingProfile( |
| 822 path_, | 804 path_, |
| 823 delegate_, | 805 delegate_, |
| 824 extension_policy_, | 806 extension_policy_, |
| 825 pref_service_.Pass())); | 807 pref_service_.Pass())); |
| 826 } | 808 } |
| OLD | NEW |