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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 } | 609 } |
610 | 610 |
611 net::URLRequestContextGetter* TestingProfile::GetRequestContextForRenderProcess( | 611 net::URLRequestContextGetter* TestingProfile::GetRequestContextForRenderProcess( |
612 int renderer_child_id) { | 612 int renderer_child_id) { |
613 ExtensionService* extension_service = | 613 ExtensionService* extension_service = |
614 extensions::ExtensionSystem::Get(this)->extension_service(); | 614 extensions::ExtensionSystem::Get(this)->extension_service(); |
615 if (extension_service) { | 615 if (extension_service) { |
616 const extensions::Extension* installed_app = extension_service-> | 616 const extensions::Extension* installed_app = extension_service-> |
617 GetInstalledAppForRenderer(renderer_child_id); | 617 GetInstalledAppForRenderer(renderer_child_id); |
618 if (installed_app != NULL && installed_app->is_storage_isolated()) | 618 if (installed_app != NULL && installed_app->is_storage_isolated()) |
619 return GetRequestContextForIsolatedApp(installed_app->id()); | 619 return GetRequestContextForStoragePartition(installed_app->id()); |
620 } | 620 } |
621 | 621 |
622 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( | 622 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
623 renderer_child_id); | 623 renderer_child_id); |
624 if (rph && rph->IsGuest()) { | 624 if (rph && rph->IsGuest()) { |
625 // For guest processes (used by the browser tag), we need to isolate the | 625 // For guest processes (used by the browser tag), we need to isolate the |
626 // storage. | 626 // storage. |
627 // TODO(nasko): Until we have proper storage partitions, create a | 627 // TODO(nasko): Until we have proper storage partitions, create a |
628 // non-persistent context using the RPH's id. | 628 // non-persistent context using the RPH's id. |
629 std::string id("guest-"); | 629 std::string id("guest-"); |
630 id.append(base::IntToString(renderer_child_id)); | 630 id.append(base::IntToString(renderer_child_id)); |
631 return GetRequestContextForIsolatedApp(id); | 631 return GetRequestContextForStoragePartition(id); |
632 } | 632 } |
633 | 633 |
634 return GetRequestContext(); | 634 return GetRequestContext(); |
635 } | 635 } |
636 | 636 |
637 void TestingProfile::CreateRequestContext() { | 637 void TestingProfile::CreateRequestContext() { |
638 if (!request_context_) | 638 if (!request_context_) |
639 request_context_ = | 639 request_context_ = |
640 new TestURLRequestContextGetter( | 640 new TestURLRequestContextGetter( |
641 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 641 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
(...skipping 10 matching lines...) Expand all Loading... |
652 net::URLRequestContextGetter* TestingProfile::GetMediaRequestContext() { | 652 net::URLRequestContextGetter* TestingProfile::GetMediaRequestContext() { |
653 return NULL; | 653 return NULL; |
654 } | 654 } |
655 | 655 |
656 net::URLRequestContextGetter* | 656 net::URLRequestContextGetter* |
657 TestingProfile::GetMediaRequestContextForRenderProcess( | 657 TestingProfile::GetMediaRequestContextForRenderProcess( |
658 int renderer_child_id) { | 658 int renderer_child_id) { |
659 return NULL; | 659 return NULL; |
660 } | 660 } |
661 | 661 |
| 662 net::URLRequestContextGetter* |
| 663 TestingProfile::GetMediaRequestContextForStoragePartition( |
| 664 const std::string& partition_id) { |
| 665 return NULL; |
| 666 } |
| 667 |
662 net::URLRequestContextGetter* TestingProfile::GetRequestContextForExtensions() { | 668 net::URLRequestContextGetter* TestingProfile::GetRequestContextForExtensions() { |
663 if (!extensions_request_context_) | 669 if (!extensions_request_context_) |
664 extensions_request_context_ = new TestExtensionURLRequestContextGetter(); | 670 extensions_request_context_ = new TestExtensionURLRequestContextGetter(); |
665 return extensions_request_context_.get(); | 671 return extensions_request_context_.get(); |
666 } | 672 } |
667 | 673 |
668 net::SSLConfigService* TestingProfile::GetSSLConfigService() { | 674 net::SSLConfigService* TestingProfile::GetSSLConfigService() { |
669 return NULL; | 675 return NULL; |
670 } | 676 } |
671 | 677 |
672 net::URLRequestContextGetter* TestingProfile::GetRequestContextForIsolatedApp( | 678 net::URLRequestContextGetter* |
673 const std::string& app_id) { | 679 TestingProfile::GetRequestContextForStoragePartition( |
674 // We don't test isolated app storage here yet, so returning the same dummy | 680 const std::string& partition_id) { |
| 681 // We don't test storage partitions here yet, so returning the same dummy |
675 // context is sufficient for now. | 682 // context is sufficient for now. |
676 return GetRequestContext(); | 683 return GetRequestContext(); |
677 } | 684 } |
678 | 685 |
679 content::ResourceContext* TestingProfile::GetResourceContext() { | 686 content::ResourceContext* TestingProfile::GetResourceContext() { |
680 if (!resource_context_.get()) | 687 if (!resource_context_.get()) |
681 resource_context_.reset(new content::MockResourceContext()); | 688 resource_context_.reset(new content::MockResourceContext()); |
682 return resource_context_.get(); | 689 return resource_context_.get(); |
683 } | 690 } |
684 | 691 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { | 836 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { |
830 DCHECK(!build_called_); | 837 DCHECK(!build_called_); |
831 build_called_ = true; | 838 build_called_ = true; |
832 return scoped_ptr<TestingProfile>(new TestingProfile( | 839 return scoped_ptr<TestingProfile>(new TestingProfile( |
833 path_, | 840 path_, |
834 delegate_, | 841 delegate_, |
835 extension_policy_, | 842 extension_policy_, |
836 pref_service_.Pass(), | 843 pref_service_.Pass(), |
837 user_cloud_policy_manager_.Pass())); | 844 user_cloud_policy_manager_.Pass())); |
838 } | 845 } |
OLD | NEW |