| 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 "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" | 
| 9 #include "content/public/test/mock_resource_context.h" | 11 #include "content/public/test/mock_resource_context.h" | 
| 10 #include "net/url_request/url_request_context.h" | 12 #include "net/url_request/url_request_context.h" | 
| 11 #include "net/url_request/url_request_context_getter.h" | 13 #include "net/url_request/url_request_context_getter.h" | 
| 12 #include "net/url_request/url_request_test_util.h" | 14 #include "net/url_request/url_request_test_util.h" | 
| 13 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" | 
| 14 #include "webkit/browser/quota/special_storage_policy.h" | 16 #include "webkit/browser/quota/special_storage_policy.h" | 
| 15 | 17 | 
| 16 namespace { | 18 namespace { | 
| 17 | 19 | 
| 18 class TestContextURLRequestContextGetter : public net::URLRequestContextGetter { | 20 class TestContextURLRequestContextGetter : public net::URLRequestContextGetter { | 
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 63 | 65 | 
| 64 bool TestBrowserContext::IsOffTheRecord() const { | 66 bool TestBrowserContext::IsOffTheRecord() const { | 
| 65   return false; | 67   return false; | 
| 66 } | 68 } | 
| 67 | 69 | 
| 68 DownloadManagerDelegate* TestBrowserContext::GetDownloadManagerDelegate() { | 70 DownloadManagerDelegate* TestBrowserContext::GetDownloadManagerDelegate() { | 
| 69   return NULL; | 71   return NULL; | 
| 70 } | 72 } | 
| 71 | 73 | 
| 72 net::URLRequestContextGetter* TestBrowserContext::GetRequestContext() { | 74 net::URLRequestContextGetter* TestBrowserContext::GetRequestContext() { | 
| 73   if (!request_context_.get()) { | 75   return GetDefaultStoragePartition(this)->GetURLRequestContext(); | 
| 74     request_context_ = new TestContextURLRequestContextGetter(); |  | 
| 75   } |  | 
| 76   return request_context_.get(); |  | 
| 77 } | 76 } | 
| 78 | 77 | 
| 79 net::URLRequestContextGetter* | 78 net::URLRequestContextGetter* | 
| 80 TestBrowserContext::GetRequestContextForRenderProcess(int renderer_child_id) { | 79 TestBrowserContext::GetRequestContextForRenderProcess(int renderer_child_id) { | 
| 81   return NULL; | 80   return NULL; | 
| 82 } | 81 } | 
| 83 | 82 | 
| 84 net::URLRequestContextGetter* TestBrowserContext::GetMediaRequestContext() { | 83 net::URLRequestContextGetter* TestBrowserContext::GetMediaRequestContext() { | 
| 85   return NULL; | 84   return NULL; | 
| 86 } | 85 } | 
| (...skipping 15 matching lines...) Expand all  Loading... | 
| 102       int render_process_id, | 101       int render_process_id, | 
| 103       int render_view_id, | 102       int render_view_id, | 
| 104       const GURL& requesting_frame, | 103       const GURL& requesting_frame, | 
| 105       const MIDISysExPermissionCallback& callback) { | 104       const MIDISysExPermissionCallback& callback) { | 
| 106   // Always reject requests for testing. | 105   // Always reject requests for testing. | 
| 107   callback.Run(false); | 106   callback.Run(false); | 
| 108 } | 107 } | 
| 109 | 108 | 
| 110 ResourceContext* TestBrowserContext::GetResourceContext() { | 109 ResourceContext* TestBrowserContext::GetResourceContext() { | 
| 111   if (!resource_context_) | 110   if (!resource_context_) | 
| 112     resource_context_.reset(new MockResourceContext( | 111     resource_context_.reset(new MockResourceContext()); | 
| 113         GetRequestContext()->GetURLRequestContext())); |  | 
| 114   return resource_context_.get(); | 112   return resource_context_.get(); | 
| 115 } | 113 } | 
| 116 | 114 | 
| 117 GeolocationPermissionContext* | 115 GeolocationPermissionContext* | 
| 118     TestBrowserContext::GetGeolocationPermissionContext() { | 116     TestBrowserContext::GetGeolocationPermissionContext() { | 
| 119   return NULL; | 117   return NULL; | 
| 120 } | 118 } | 
| 121 | 119 | 
| 122 quota::SpecialStoragePolicy* TestBrowserContext::GetSpecialStoragePolicy() { | 120 quota::SpecialStoragePolicy* TestBrowserContext::GetSpecialStoragePolicy() { | 
| 123   return special_storage_policy_.get(); | 121   return special_storage_policy_.get(); | 
| 124 } | 122 } | 
| 125 | 123 | 
| 126 }  // namespace content | 124 }  // namespace content | 
| OLD | NEW | 
|---|