| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/shell/browser/layout_test/layout_test_browser_context.h" | 5 #include "content/shell/browser/layout_test/layout_test_browser_context.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 return nullptr; | 66 return nullptr; |
| 67 | 67 |
| 68 prefix = prefix.AppendASCII("gen"); | 68 prefix = prefix.AppendASCII("gen"); |
| 69 | 69 |
| 70 base::FilePath path = prefix.AppendASCII(url.path().substr(2) + ".js"); | 70 base::FilePath path = prefix.AppendASCII(url.path().substr(2) + ".js"); |
| 71 if (path.ReferencesParent()) | 71 if (path.ReferencesParent()) |
| 72 return nullptr; | 72 return nullptr; |
| 73 | 73 |
| 74 return new net::URLRequestFileJob( | 74 return new net::URLRequestFileJob( |
| 75 request, network_delegate, path, | 75 request, network_delegate, path, |
| 76 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 76 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE)); |
| 77 } | 77 } |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 } // namespace | 80 } // namespace |
| 81 | 81 |
| 82 LayoutTestBrowserContext::LayoutTestBrowserContext(bool off_the_record, | 82 LayoutTestBrowserContext::LayoutTestBrowserContext(bool off_the_record, |
| 83 net::NetLog* net_log) | 83 net::NetLog* net_log) |
| 84 : ShellBrowserContext(off_the_record, net_log) { | 84 : ShellBrowserContext(off_the_record, net_log) { |
| 85 ignore_certificate_errors_ = true; | 85 ignore_certificate_errors_ = true; |
| 86 } | 86 } |
| 87 | 87 |
| 88 LayoutTestBrowserContext::~LayoutTestBrowserContext() { | 88 LayoutTestBrowserContext::~LayoutTestBrowserContext() { |
| 89 } | 89 } |
| 90 | 90 |
| 91 ShellURLRequestContextGetter* | 91 ShellURLRequestContextGetter* |
| 92 LayoutTestBrowserContext::CreateURLRequestContextGetter( | 92 LayoutTestBrowserContext::CreateURLRequestContextGetter( |
| 93 ProtocolHandlerMap* protocol_handlers, | 93 ProtocolHandlerMap* protocol_handlers, |
| 94 URLRequestInterceptorScopedVector request_interceptors) { | 94 URLRequestInterceptorScopedVector request_interceptors) { |
| 95 protocol_handlers->insert(std::make_pair( | 95 protocol_handlers->insert(std::make_pair( |
| 96 "layout-test-mojom", make_linked_ptr(new MojomProtocolHandler))); | 96 "layout-test-mojom", make_linked_ptr(new MojomProtocolHandler))); |
| 97 return new LayoutTestURLRequestContextGetter( | 97 return new LayoutTestURLRequestContextGetter( |
| 98 ignore_certificate_errors(), GetPath(), | 98 ignore_certificate_errors(), GetPath(), |
| 99 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 99 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), |
| 100 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), | 100 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), |
| 101 protocol_handlers, std::move(request_interceptors), net_log()); | 101 protocol_handlers, std::move(request_interceptors), net_log()); |
| 102 } | 102 } |
| 103 | 103 |
| 104 DownloadManagerDelegate* | 104 DownloadManagerDelegate* |
| 105 LayoutTestBrowserContext::GetDownloadManagerDelegate() { | 105 LayoutTestBrowserContext::GetDownloadManagerDelegate() { |
| 106 if (!download_manager_delegate_) { | 106 if (!download_manager_delegate_) { |
| 107 download_manager_delegate_.reset(new LayoutTestDownloadManagerDelegate()); | 107 download_manager_delegate_.reset(new LayoutTestDownloadManagerDelegate()); |
| 108 download_manager_delegate_->SetDownloadManager( | 108 download_manager_delegate_->SetDownloadManager( |
| 109 BrowserContext::GetDownloadManager(this)); | 109 BrowserContext::GetDownloadManager(this)); |
| 110 download_manager_delegate_->SetDownloadBehaviorForTesting( | 110 download_manager_delegate_->SetDownloadBehaviorForTesting( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 132 background_sync_controller_.reset(new MockBackgroundSyncController()); | 132 background_sync_controller_.reset(new MockBackgroundSyncController()); |
| 133 return background_sync_controller_.get(); | 133 return background_sync_controller_.get(); |
| 134 } | 134 } |
| 135 | 135 |
| 136 LayoutTestPermissionManager* | 136 LayoutTestPermissionManager* |
| 137 LayoutTestBrowserContext::GetLayoutTestPermissionManager() { | 137 LayoutTestBrowserContext::GetLayoutTestPermissionManager() { |
| 138 return static_cast<LayoutTestPermissionManager*>(GetPermissionManager()); | 138 return static_cast<LayoutTestPermissionManager*>(GetPermissionManager()); |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace content | 141 } // namespace content |
| OLD | NEW |