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/shell/app/shell_main_delegate.h" | 5 #include "content/shell/app/shell_main_delegate.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/cpu.h" | 9 #include "base/cpu.h" |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "cc/base/switches.h" | 16 #include "cc/base/switches.h" |
17 #include "components/test_runner/blink_test_platform_support.h" | 17 #include "components/test_runner/blink_test_platform_support.h" |
18 #include "content/common/content_constants_internal.h" | 18 #include "content/common/content_constants_internal.h" |
19 #include "content/public/browser/browser_main_runner.h" | 19 #include "content/public/browser/browser_main_runner.h" |
20 #include "content/public/common/content_switches.h" | 20 #include "content/public/common/content_switches.h" |
21 #include "content/public/common/url_constants.h" | 21 #include "content/public/common/url_constants.h" |
22 #include "content/public/test/layouttest_support.h" | 22 #include "content/public/test/layouttest_support.h" |
| 23 #include "content/public/test/ppapi_test_utils.h" |
23 #include "content/shell/app/shell_crash_reporter_client.h" | 24 #include "content/shell/app/shell_crash_reporter_client.h" |
24 #include "content/shell/browser/layout_test/layout_test_browser_main.h" | 25 #include "content/shell/browser/layout_test/layout_test_browser_main.h" |
25 #include "content/shell/browser/layout_test/layout_test_content_browser_client.h
" | 26 #include "content/shell/browser/layout_test/layout_test_content_browser_client.h
" |
26 #include "content/shell/browser/shell_browser_main.h" | 27 #include "content/shell/browser/shell_browser_main.h" |
27 #include "content/shell/browser/shell_content_browser_client.h" | 28 #include "content/shell/browser/shell_content_browser_client.h" |
28 #include "content/shell/common/shell_switches.h" | 29 #include "content/shell/common/shell_switches.h" |
29 #include "content/shell/renderer/layout_test/layout_test_content_renderer_client
.h" | 30 #include "content/shell/renderer/layout_test/layout_test_content_renderer_client
.h" |
30 #include "content/shell/renderer/shell_content_renderer_client.h" | 31 #include "content/shell/renderer/shell_content_renderer_client.h" |
31 #include "content/shell/utility/shell_content_utility_client.h" | 32 #include "content/shell/utility/shell_content_utility_client.h" |
32 #include "media/base/media_switches.h" | 33 #include "media/base/media_switches.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 namespace content { | 114 namespace content { |
114 | 115 |
115 ShellMainDelegate::ShellMainDelegate() { | 116 ShellMainDelegate::ShellMainDelegate() { |
116 } | 117 } |
117 | 118 |
118 ShellMainDelegate::~ShellMainDelegate() { | 119 ShellMainDelegate::~ShellMainDelegate() { |
119 } | 120 } |
120 | 121 |
121 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { | 122 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { |
122 base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); | 123 base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); |
| 124 int dummy; |
| 125 if (!exit_code) |
| 126 exit_code = &dummy; |
123 | 127 |
124 #if defined(OS_WIN) | 128 #if defined(OS_WIN) |
125 // Enable trace control and transport through event tracing for Windows. | 129 // Enable trace control and transport through event tracing for Windows. |
126 logging::LogEventProvider::Initialize(kContentShellProviderName); | 130 logging::LogEventProvider::Initialize(kContentShellProviderName); |
127 | 131 |
128 v8_breakpad_support::SetUp(); | 132 v8_breakpad_support::SetUp(); |
129 #endif | 133 #endif |
130 #if defined(OS_MACOSX) | 134 #if defined(OS_MACOSX) |
131 // Needs to happen before InitializeResourceBundle() and before | 135 // Needs to happen before InitializeResourceBundle() and before |
132 // BlinkTestPlatformInitialize() are called. | 136 // BlinkTestPlatformInitialize() are called. |
133 OverrideFrameworkBundlePath(); | 137 OverrideFrameworkBundlePath(); |
134 OverrideChildProcessPath(); | 138 OverrideChildProcessPath(); |
135 EnsureCorrectResolutionSettings(); | 139 EnsureCorrectResolutionSettings(); |
136 #endif // OS_MACOSX | 140 #endif // OS_MACOSX |
137 | 141 |
138 InitLogging(); | 142 InitLogging(); |
139 if (command_line.HasSwitch(switches::kCheckLayoutTestSysDeps)) { | 143 if (command_line.HasSwitch(switches::kCheckLayoutTestSysDeps)) { |
140 // If CheckLayoutSystemDeps succeeds, we don't exit early. Instead we | 144 // If CheckLayoutSystemDeps succeeds, we don't exit early. Instead we |
141 // continue and try to load the fonts in BlinkTestPlatformInitialize | 145 // continue and try to load the fonts in BlinkTestPlatformInitialize |
142 // below, and then try to bring up the rest of the content module. | 146 // below, and then try to bring up the rest of the content module. |
143 if (!test_runner::CheckLayoutSystemDeps()) { | 147 if (!test_runner::CheckLayoutSystemDeps()) { |
144 if (exit_code) | 148 *exit_code = 1; |
145 *exit_code = 1; | |
146 return true; | 149 return true; |
147 } | 150 } |
148 } | 151 } |
149 | 152 |
150 if (command_line.HasSwitch(switches::kRunLayoutTest)) { | 153 if (command_line.HasSwitch(switches::kRunLayoutTest)) { |
151 EnableBrowserLayoutTestMode(); | 154 EnableBrowserLayoutTestMode(); |
152 | 155 |
| 156 #if defined(ENABLE_PLUGINS) |
| 157 if (!ppapi::RegisterBlinkTestPlugin(&command_line)) { |
| 158 *exit_code = 1; |
| 159 return true; |
| 160 } |
| 161 #endif |
153 command_line.AppendSwitch(switches::kProcessPerTab); | 162 command_line.AppendSwitch(switches::kProcessPerTab); |
154 command_line.AppendSwitch(switches::kEnableLogging); | 163 command_line.AppendSwitch(switches::kEnableLogging); |
155 command_line.AppendSwitch(switches::kAllowFileAccessFromFiles); | 164 command_line.AppendSwitch(switches::kAllowFileAccessFromFiles); |
156 // only default to osmesa if the flag isn't already specified. | 165 // only default to osmesa if the flag isn't already specified. |
157 if (!command_line.HasSwitch(switches::kUseGL)) { | 166 if (!command_line.HasSwitch(switches::kUseGL)) { |
158 command_line.AppendSwitchASCII(switches::kUseGL, | 167 command_line.AppendSwitchASCII(switches::kUseGL, |
159 gfx::kGLImplementationOSMesaName); | 168 gfx::kGLImplementationOSMesaName); |
160 } | 169 } |
161 command_line.AppendSwitch(switches::kSkipGpuDataLoading); | 170 command_line.AppendSwitch(switches::kSkipGpuDataLoading); |
162 command_line.AppendSwitchASCII(switches::kTouchEvents, | 171 command_line.AppendSwitchASCII(switches::kTouchEvents, |
(...skipping 28 matching lines...) Expand all Loading... |
191 command_line.AppendSwitchASCII(switches::kHostResolverRules, | 200 command_line.AppendSwitchASCII(switches::kHostResolverRules, |
192 "MAP *.test 127.0.0.1"); | 201 "MAP *.test 127.0.0.1"); |
193 | 202 |
194 // Unless/until WebM files are added to the media layout tests, we need to | 203 // Unless/until WebM files are added to the media layout tests, we need to |
195 // avoid removing MP4/H264/AAC so that layout tests can run on Android. | 204 // avoid removing MP4/H264/AAC so that layout tests can run on Android. |
196 #if !defined(OS_ANDROID) | 205 #if !defined(OS_ANDROID) |
197 media::RemoveProprietaryMediaTypesAndCodecsForTests(); | 206 media::RemoveProprietaryMediaTypesAndCodecsForTests(); |
198 #endif | 207 #endif |
199 | 208 |
200 if (!test_runner::BlinkTestPlatformInitialize()) { | 209 if (!test_runner::BlinkTestPlatformInitialize()) { |
201 if (exit_code) | 210 *exit_code = 1; |
202 *exit_code = 1; | |
203 return true; | 211 return true; |
204 } | 212 } |
205 } | 213 } |
206 SetContentClient(&content_client_); | 214 SetContentClient(&content_client_); |
207 return false; | 215 return false; |
208 } | 216 } |
209 | 217 |
210 void ShellMainDelegate::PreSandboxStartup() { | 218 void ShellMainDelegate::PreSandboxStartup() { |
211 #if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX)) | 219 #if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX)) |
212 // Create an instance of the CPU class to parse /proc/cpuinfo and cache | 220 // Create an instance of the CPU class to parse /proc/cpuinfo and cache |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 | 351 |
344 return renderer_client_.get(); | 352 return renderer_client_.get(); |
345 } | 353 } |
346 | 354 |
347 ContentUtilityClient* ShellMainDelegate::CreateContentUtilityClient() { | 355 ContentUtilityClient* ShellMainDelegate::CreateContentUtilityClient() { |
348 utility_client_.reset(new ShellContentUtilityClient); | 356 utility_client_.reset(new ShellContentUtilityClient); |
349 return utility_client_.get(); | 357 return utility_client_.get(); |
350 } | 358 } |
351 | 359 |
352 } // namespace content | 360 } // namespace content |
OLD | NEW |