OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/test/content_browser_test.h" | 5 #include "content/test/content_browser_test.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/stack_trace.h" | 8 #include "base/debug/stack_trace.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
13 #include "content/public/browser/render_process_host.h" | 13 #include "content/public/browser/render_process_host.h" |
14 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
15 #include "content/public/common/url_constants.h" | 15 #include "content/public/common/url_constants.h" |
16 #include "content/shell/shell.h" | 16 #include "content/shell/shell.h" |
17 #include "content/shell/shell_browser_context.h" | 17 #include "content/shell/shell_browser_context.h" |
18 #include "content/shell/shell_content_browser_client.h" | 18 #include "content/shell/shell_content_browser_client.h" |
| 19 #include "content/shell/shell_content_renderer_client.h" |
19 #include "content/shell/shell_main_delegate.h" | 20 #include "content/shell/shell_main_delegate.h" |
20 #include "content/shell/shell_switches.h" | 21 #include "content/shell/shell_switches.h" |
21 #include "content/test/test_content_client.h" | 22 #include "content/test/test_content_client.h" |
22 | 23 |
23 #if defined(OS_MACOSX) | 24 #if defined(OS_MACOSX) |
24 #include "base/mac/scoped_nsautorelease_pool.h" | 25 #include "base/mac/scoped_nsautorelease_pool.h" |
25 #endif | 26 #endif |
26 | 27 |
27 namespace content { | 28 namespace content { |
28 | 29 |
(...skipping 20 matching lines...) Expand all Loading... |
49 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 50 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
50 command_line->AppendSwitch(switches::kContentBrowserTest); | 51 command_line->AppendSwitch(switches::kContentBrowserTest); |
51 | 52 |
52 #if defined(OS_LINUX) | 53 #if defined(OS_LINUX) |
53 // http://crbug.com/139209 | 54 // http://crbug.com/139209 |
54 command_line->AppendSwitch(switches::kDisableGpuProcessPrelaunch); | 55 command_line->AppendSwitch(switches::kDisableGpuProcessPrelaunch); |
55 #endif | 56 #endif |
56 | 57 |
57 SetUpCommandLine(command_line); | 58 SetUpCommandLine(command_line); |
58 | 59 |
| 60 // Single-process mode is not set in BrowserMain, so process it explicitly, |
| 61 // and set up renderer. |
| 62 if (command_line->HasSwitch(switches::kSingleProcess)) { |
| 63 RenderProcessHost::set_run_renderer_in_process(true); |
| 64 single_process_renderer_client_.reset(new ShellContentRendererClient); |
| 65 content::GetContentClient()->set_renderer_for_testing( |
| 66 single_process_renderer_client_.get()); |
| 67 } |
| 68 |
59 #if defined(OS_MACOSX) | 69 #if defined(OS_MACOSX) |
60 // See InProcessBrowserTest::PrepareTestCommandLine(). | 70 // See InProcessBrowserTest::PrepareTestCommandLine(). |
61 FilePath subprocess_path; | 71 FilePath subprocess_path; |
62 PathService::Get(base::FILE_EXE, &subprocess_path); | 72 PathService::Get(base::FILE_EXE, &subprocess_path); |
63 subprocess_path = subprocess_path.DirName().DirName(); | 73 subprocess_path = subprocess_path.DirName().DirName(); |
64 DCHECK_EQ(subprocess_path.BaseName().value(), "Contents"); | 74 DCHECK_EQ(subprocess_path.BaseName().value(), "Contents"); |
65 subprocess_path = subprocess_path.Append( | 75 subprocess_path = subprocess_path.Append( |
66 "Frameworks/Content Shell Helper.app/Contents/MacOS/Content Shell Helper")
; | 76 "Frameworks/Content Shell Helper.app/Contents/MacOS/Content Shell Helper")
; |
67 command_line->AppendSwitchPath(switches::kBrowserSubprocessPath, | 77 command_line->AppendSwitchPath(switches::kBrowserSubprocessPath, |
68 subprocess_path); | 78 subprocess_path); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 static_cast<ShellContentBrowserClient*>(GetContentClient()->browser()); | 149 static_cast<ShellContentBrowserClient*>(GetContentClient()->browser()); |
140 return Shell::CreateNewWindow( | 150 return Shell::CreateNewWindow( |
141 browser_client->off_the_record_browser_context(), | 151 browser_client->off_the_record_browser_context(), |
142 GURL(chrome::kAboutBlankURL), | 152 GURL(chrome::kAboutBlankURL), |
143 NULL, | 153 NULL, |
144 MSG_ROUTING_NONE, | 154 MSG_ROUTING_NONE, |
145 NULL); | 155 NULL); |
146 } | 156 } |
147 | 157 |
148 } // namespace content | 158 } // namespace content |
OLD | NEW |