Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: trunk/src/content/public/test/test_browser_context.cc

Issue 23551005: Revert 219709 "Remove the Extensions URLRequestContext." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "content/public/test/test_browser_context.h" 5 #include "content/public/test/test_browser_context.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/test/null_task_runner.h" 8 #include "base/test/null_task_runner.h"
9 #include "content/public/browser/cookie_store_factory.h"
10 #include "content/public/browser/storage_partition.h"
11 #include "content/public/test/mock_resource_context.h" 9 #include "content/public/test/mock_resource_context.h"
12 #include "net/url_request/url_request_context.h" 10 #include "net/url_request/url_request_context.h"
13 #include "net/url_request/url_request_context_getter.h" 11 #include "net/url_request/url_request_context_getter.h"
14 #include "net/url_request/url_request_test_util.h" 12 #include "net/url_request/url_request_test_util.h"
15 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
16 #include "webkit/browser/quota/special_storage_policy.h" 14 #include "webkit/browser/quota/special_storage_policy.h"
17 15
18 namespace { 16 namespace {
19 17
20 class TestContextURLRequestContextGetter : public net::URLRequestContextGetter { 18 class TestContextURLRequestContextGetter : public net::URLRequestContextGetter {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 63
66 bool TestBrowserContext::IsOffTheRecord() const { 64 bool TestBrowserContext::IsOffTheRecord() const {
67 return false; 65 return false;
68 } 66 }
69 67
70 DownloadManagerDelegate* TestBrowserContext::GetDownloadManagerDelegate() { 68 DownloadManagerDelegate* TestBrowserContext::GetDownloadManagerDelegate() {
71 return NULL; 69 return NULL;
72 } 70 }
73 71
74 net::URLRequestContextGetter* TestBrowserContext::GetRequestContext() { 72 net::URLRequestContextGetter* TestBrowserContext::GetRequestContext() {
75 return GetDefaultStoragePartition(this)->GetURLRequestContext(); 73 if (!request_context_.get()) {
74 request_context_ = new TestContextURLRequestContextGetter();
75 }
76 return request_context_.get();
76 } 77 }
77 78
78 net::URLRequestContextGetter* 79 net::URLRequestContextGetter*
79 TestBrowserContext::GetRequestContextForRenderProcess(int renderer_child_id) { 80 TestBrowserContext::GetRequestContextForRenderProcess(int renderer_child_id) {
80 return NULL; 81 return NULL;
81 } 82 }
82 83
83 net::URLRequestContextGetter* TestBrowserContext::GetMediaRequestContext() { 84 net::URLRequestContextGetter* TestBrowserContext::GetMediaRequestContext() {
84 return NULL; 85 return NULL;
85 } 86 }
(...skipping 15 matching lines...) Expand all
101 int render_process_id, 102 int render_process_id,
102 int render_view_id, 103 int render_view_id,
103 const GURL& requesting_frame, 104 const GURL& requesting_frame,
104 const MIDISysExPermissionCallback& callback) { 105 const MIDISysExPermissionCallback& callback) {
105 // Always reject requests for testing. 106 // Always reject requests for testing.
106 callback.Run(false); 107 callback.Run(false);
107 } 108 }
108 109
109 ResourceContext* TestBrowserContext::GetResourceContext() { 110 ResourceContext* TestBrowserContext::GetResourceContext() {
110 if (!resource_context_) 111 if (!resource_context_)
111 resource_context_.reset(new MockResourceContext()); 112 resource_context_.reset(new MockResourceContext(
113 GetRequestContext()->GetURLRequestContext()));
112 return resource_context_.get(); 114 return resource_context_.get();
113 } 115 }
114 116
115 GeolocationPermissionContext* 117 GeolocationPermissionContext*
116 TestBrowserContext::GetGeolocationPermissionContext() { 118 TestBrowserContext::GetGeolocationPermissionContext() {
117 return NULL; 119 return NULL;
118 } 120 }
119 121
120 quota::SpecialStoragePolicy* TestBrowserContext::GetSpecialStoragePolicy() { 122 quota::SpecialStoragePolicy* TestBrowserContext::GetSpecialStoragePolicy() {
121 return special_storage_policy_.get(); 123 return special_storage_policy_.get();
122 } 124 }
123 125
124 } // namespace content 126 } // namespace content
OLDNEW
« no previous file with comments | « trunk/src/content/public/test/mock_resource_context.cc ('k') | trunk/src/content/shell/app/shell_main_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698