| 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 DownloadManagerDelegate* TestingProfile::GetDownloadManagerDelegate() { | 577 DownloadManagerDelegate* TestingProfile::GetDownloadManagerDelegate() { |
| 578 return NULL; | 578 return NULL; |
| 579 } | 579 } |
| 580 | 580 |
| 581 net::URLRequestContextGetter* TestingProfile::GetRequestContext() { | 581 net::URLRequestContextGetter* TestingProfile::GetRequestContext() { |
| 582 return request_context_.get(); | 582 return request_context_.get(); |
| 583 } | 583 } |
| 584 | 584 |
| 585 net::URLRequestContextGetter* TestingProfile::CreateRequestContext( | 585 net::URLRequestContextGetter* TestingProfile::CreateRequestContext( |
| 586 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 586 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 587 blob_protocol_handler, | |
| 588 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 589 file_system_protocol_handler, | |
| 590 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 591 developer_protocol_handler, | 587 developer_protocol_handler, |
| 592 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 588 content::ProtocolHandlerMap* protocol_handlers) { |
| 593 chrome_protocol_handler, | |
| 594 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 595 chrome_devtools_protocol_handler) { | |
| 596 return request_context_.get(); | 589 return request_context_.get(); |
| 597 } | 590 } |
| 598 | 591 |
| 599 net::URLRequestContextGetter* TestingProfile::GetRequestContextForRenderProcess( | 592 net::URLRequestContextGetter* TestingProfile::GetRequestContextForRenderProcess( |
| 600 int renderer_child_id) { | 593 int renderer_child_id) { |
| 601 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( | 594 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
| 602 renderer_child_id); | 595 renderer_child_id); |
| 603 return rph->GetStoragePartition()->GetURLRequestContext(); | 596 return rph->GetStoragePartition()->GetURLRequestContext(); |
| 604 } | 597 } |
| 605 | 598 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 if (!GetRequestContext()) | 638 if (!GetRequestContext()) |
| 646 return NULL; | 639 return NULL; |
| 647 return GetRequestContext()->GetURLRequestContext()->ssl_config_service(); | 640 return GetRequestContext()->GetURLRequestContext()->ssl_config_service(); |
| 648 } | 641 } |
| 649 | 642 |
| 650 net::URLRequestContextGetter* | 643 net::URLRequestContextGetter* |
| 651 TestingProfile::CreateRequestContextForStoragePartition( | 644 TestingProfile::CreateRequestContextForStoragePartition( |
| 652 const base::FilePath& partition_path, | 645 const base::FilePath& partition_path, |
| 653 bool in_memory, | 646 bool in_memory, |
| 654 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 647 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 655 blob_protocol_handler, | |
| 656 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 657 file_system_protocol_handler, | |
| 658 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 659 developer_protocol_handler, | 648 developer_protocol_handler, |
| 660 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 649 content::ProtocolHandlerMap* protocol_handlers) { |
| 661 chrome_protocol_handler, | |
| 662 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 663 chrome_devtools_protocol_handler) { | |
| 664 // We don't test storage partitions here yet, so returning the same dummy | 650 // We don't test storage partitions here yet, so returning the same dummy |
| 665 // context is sufficient for now. | 651 // context is sufficient for now. |
| 666 return GetRequestContext(); | 652 return GetRequestContext(); |
| 667 } | 653 } |
| 668 | 654 |
| 669 content::ResourceContext* TestingProfile::GetResourceContext() { | 655 content::ResourceContext* TestingProfile::GetResourceContext() { |
| 670 if (!resource_context_.get()) | 656 if (!resource_context_.get()) |
| 671 resource_context_.reset(new content::MockResourceContext()); | 657 resource_context_.reset(new content::MockResourceContext()); |
| 672 return resource_context_.get(); | 658 return resource_context_.get(); |
| 673 } | 659 } |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 | 795 |
| 810 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { | 796 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { |
| 811 DCHECK(!build_called_); | 797 DCHECK(!build_called_); |
| 812 build_called_ = true; | 798 build_called_ = true; |
| 813 return scoped_ptr<TestingProfile>(new TestingProfile( | 799 return scoped_ptr<TestingProfile>(new TestingProfile( |
| 814 path_, | 800 path_, |
| 815 delegate_, | 801 delegate_, |
| 816 extension_policy_, | 802 extension_policy_, |
| 817 pref_service_.Pass())); | 803 pref_service_.Pass())); |
| 818 } | 804 } |
| OLD | NEW |