| 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 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 } | 601 } |
| 602 | 602 |
| 603 net::URLRequestContextGetter* TestingProfile::GetRequestContext() { | 603 net::URLRequestContextGetter* TestingProfile::GetRequestContext() { |
| 604 return request_context_.get(); | 604 return request_context_.get(); |
| 605 } | 605 } |
| 606 | 606 |
| 607 net::URLRequestContextGetter* TestingProfile::GetRequestContextForRenderProcess( | 607 net::URLRequestContextGetter* TestingProfile::GetRequestContextForRenderProcess( |
| 608 int renderer_child_id) { | 608 int renderer_child_id) { |
| 609 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( | 609 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
| 610 renderer_child_id); | 610 renderer_child_id); |
| 611 content::StoragePartition* storage_partition = rph->GetStoragePartition(); | 611 return rph->GetStoragePartition()->GetURLRequestContext(); |
| 612 | |
| 613 // TODO(nasko): Remove this conditional, once webview tag creates a proper | |
| 614 // storage partition. | |
| 615 if (rph->IsGuest()) { | |
| 616 return GetRequestContextForStoragePartition( | |
| 617 storage_partition->GetPath(), true); | |
| 618 } | |
| 619 | |
| 620 return storage_partition->GetURLRequestContext(); | |
| 621 } | 612 } |
| 622 | 613 |
| 623 void TestingProfile::CreateRequestContext() { | 614 void TestingProfile::CreateRequestContext() { |
| 624 if (!request_context_) | 615 if (!request_context_) |
| 625 request_context_ = | 616 request_context_ = |
| 626 new TestURLRequestContextGetter( | 617 new TestURLRequestContextGetter( |
| 627 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 618 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 628 } | 619 } |
| 629 | 620 |
| 630 void TestingProfile::ResetRequestContext() { | 621 void TestingProfile::ResetRequestContext() { |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { | 819 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { |
| 829 DCHECK(!build_called_); | 820 DCHECK(!build_called_); |
| 830 build_called_ = true; | 821 build_called_ = true; |
| 831 return scoped_ptr<TestingProfile>(new TestingProfile( | 822 return scoped_ptr<TestingProfile>(new TestingProfile( |
| 832 path_, | 823 path_, |
| 833 delegate_, | 824 delegate_, |
| 834 extension_policy_, | 825 extension_policy_, |
| 835 pref_service_.Pass(), | 826 pref_service_.Pass(), |
| 836 user_cloud_policy_manager_.Pass())); | 827 user_cloud_policy_manager_.Pass())); |
| 837 } | 828 } |
| OLD | NEW |