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

Side by Side Diff: content/shell/browser/layout_test/layout_test_browser_context.cc

Issue 651883002: Content Shell: Introduce LayoutTestURLRequestContextGetter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@LayoutTestBrowserMainParts
Patch Set: Fix. Created 6 years, 2 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
OLDNEW
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "content/public/browser/browser_thread.h"
12 #include "content/public/browser/resource_context.h" 13 #include "content/public/browser/resource_context.h"
13 #include "content/shell/browser/layout_test/layout_test_download_manager_delegat e.h" 14 #include "content/shell/browser/layout_test/layout_test_download_manager_delegat e.h"
15 #include "content/shell/browser/layout_test/layout_test_url_request_context_gett er.h"
14 #include "content/shell/browser/shell_url_request_context_getter.h" 16 #include "content/shell/browser/shell_url_request_context_getter.h"
15 17
16 #if defined(OS_WIN) 18 #if defined(OS_WIN)
17 #include "base/base_paths_win.h" 19 #include "base/base_paths_win.h"
18 #elif defined(OS_LINUX) 20 #elif defined(OS_LINUX)
19 #include "base/nix/xdg_util.h" 21 #include "base/nix/xdg_util.h"
20 #elif defined(OS_MACOSX) 22 #elif defined(OS_MACOSX)
21 #include "base/base_paths_mac.h" 23 #include "base/base_paths_mac.h"
22 #endif 24 #endif
23 25
24 namespace content { 26 namespace content {
25 27
26 LayoutTestBrowserContext::LayoutTestBrowserContext(bool off_the_record, 28 LayoutTestBrowserContext::LayoutTestBrowserContext(bool off_the_record,
27 net::NetLog* net_log) 29 net::NetLog* net_log)
28 : ShellBrowserContext(off_the_record, net_log) { 30 : ShellBrowserContext(off_the_record, net_log) {
29 ignore_certificate_errors_ = true; 31 ignore_certificate_errors_ = true;
30 } 32 }
31 33
32 LayoutTestBrowserContext::~LayoutTestBrowserContext() { 34 LayoutTestBrowserContext::~LayoutTestBrowserContext() {
33 } 35 }
34 36
37 ShellURLRequestContextGetter*
38 LayoutTestBrowserContext::CreateURLRequestContextGetter(
39 ProtocolHandlerMap* protocol_handlers,
40 URLRequestInterceptorScopedVector request_interceptors) {
41 return new LayoutTestURLRequestContextGetter(
42 ignore_certificate_errors(),
43 GetPath(),
44 BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO),
45 BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE),
46 protocol_handlers,
47 request_interceptors.Pass(),
48 net_log());
49 }
50
35 DownloadManagerDelegate* 51 DownloadManagerDelegate*
36 LayoutTestBrowserContext::GetDownloadManagerDelegate() { 52 LayoutTestBrowserContext::GetDownloadManagerDelegate() {
37 if (!download_manager_delegate_.get()) { 53 if (!download_manager_delegate_.get()) {
38 download_manager_delegate_.reset(new LayoutTestDownloadManagerDelegate()); 54 download_manager_delegate_.reset(new LayoutTestDownloadManagerDelegate());
39 download_manager_delegate_->SetDownloadManager( 55 download_manager_delegate_->SetDownloadManager(
40 BrowserContext::GetDownloadManager(this)); 56 BrowserContext::GetDownloadManager(this));
41 download_manager_delegate_->SetDownloadBehaviorForTesting( 57 download_manager_delegate_->SetDownloadBehaviorForTesting(
42 GetPath().Append(FILE_PATH_LITERAL("downloads"))); 58 GetPath().Append(FILE_PATH_LITERAL("downloads")));
43 } 59 }
44 60
45 return download_manager_delegate_.get(); 61 return download_manager_delegate_.get();
46 } 62 }
47 63
48 } // namespace content 64 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698