| 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::Interceptor> |
| 593 developer_protocol_handler) { |
| 594 return request_context_.get(); |
| 595 } |
| 596 |
| 587 net::URLRequestContextGetter* TestingProfile::GetRequestContextForRenderProcess( | 597 net::URLRequestContextGetter* TestingProfile::GetRequestContextForRenderProcess( |
| 588 int renderer_child_id) { | 598 int renderer_child_id) { |
| 589 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( | 599 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
| 590 renderer_child_id); | 600 renderer_child_id); |
| 591 return rph->GetStoragePartition()->GetURLRequestContext(); | 601 return rph->GetStoragePartition()->GetURLRequestContext(); |
| 592 } | 602 } |
| 593 | 603 |
| 594 void TestingProfile::CreateRequestContext() { | 604 void TestingProfile::CreateRequestContext() { |
| 595 if (!request_context_) | 605 if (!request_context_) |
| 596 request_context_ = | 606 request_context_ = |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 return extensions_request_context_.get(); | 639 return extensions_request_context_.get(); |
| 630 } | 640 } |
| 631 | 641 |
| 632 net::SSLConfigService* TestingProfile::GetSSLConfigService() { | 642 net::SSLConfigService* TestingProfile::GetSSLConfigService() { |
| 633 if (!GetRequestContext()) | 643 if (!GetRequestContext()) |
| 634 return NULL; | 644 return NULL; |
| 635 return GetRequestContext()->GetURLRequestContext()->ssl_config_service(); | 645 return GetRequestContext()->GetURLRequestContext()->ssl_config_service(); |
| 636 } | 646 } |
| 637 | 647 |
| 638 net::URLRequestContextGetter* | 648 net::URLRequestContextGetter* |
| 639 TestingProfile::GetRequestContextForStoragePartition( | 649 TestingProfile::CreateRequestContextForStoragePartition( |
| 640 const FilePath& partition_path, | 650 const FilePath& partition_path, |
| 641 bool in_memory) { | 651 bool in_memory, |
| 652 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 653 blob_protocol_handler, |
| 654 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 655 file_system_protocol_handler, |
| 656 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 657 developer_protocol_handler) { |
| 642 // We don't test storage partitions here yet, so returning the same dummy | 658 // We don't test storage partitions here yet, so returning the same dummy |
| 643 // context is sufficient for now. | 659 // context is sufficient for now. |
| 644 return GetRequestContext(); | 660 return GetRequestContext(); |
| 645 } | 661 } |
| 646 | 662 |
| 647 content::ResourceContext* TestingProfile::GetResourceContext() { | 663 content::ResourceContext* TestingProfile::GetResourceContext() { |
| 648 if (!resource_context_.get()) | 664 if (!resource_context_.get()) |
| 649 resource_context_.reset(new content::MockResourceContext()); | 665 resource_context_.reset(new content::MockResourceContext()); |
| 650 return resource_context_.get(); | 666 return resource_context_.get(); |
| 651 } | 667 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 | 808 |
| 793 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { | 809 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { |
| 794 DCHECK(!build_called_); | 810 DCHECK(!build_called_); |
| 795 build_called_ = true; | 811 build_called_ = true; |
| 796 return scoped_ptr<TestingProfile>(new TestingProfile( | 812 return scoped_ptr<TestingProfile>(new TestingProfile( |
| 797 path_, | 813 path_, |
| 798 delegate_, | 814 delegate_, |
| 799 extension_policy_, | 815 extension_policy_, |
| 800 pref_service_.Pass())); | 816 pref_service_.Pass())); |
| 801 } | 817 } |
| OLD | NEW |