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 "content/common/content_constants_internal.h" | 17 #include "content/common/content_constants_internal.h" |
18 #include "content/public/browser/browser_main_runner.h" | 18 #include "content/public/browser/browser_main_runner.h" |
19 #include "content/public/common/content_switches.h" | 19 #include "content/public/common/content_switches.h" |
20 #include "content/public/common/url_constants.h" | 20 #include "content/public/common/url_constants.h" |
21 #include "content/public/test/layouttest_support.h" | 21 #include "content/public/test/layouttest_support.h" |
22 #include "content/public/test/ppapi_test_utils.h" | 22 #include "content/public/test/ppapi_test_utils.h" |
23 #include "content/shell/app/blink_test_platform_support.h" | 23 #include "content/shell/app/blink_test_platform_support.h" |
24 #include "content/shell/app/shell_crash_reporter_client.h" | 24 #include "content/shell/app/shell_crash_reporter_client.h" |
25 #include "content/shell/browser/layout_test/layout_test_browser_main.h" | 25 #include "content/shell/browser/layout_test/layout_test_browser_main.h" |
26 #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
" |
27 #include "content/shell/browser/shell_browser_main.h" | 27 #include "content/shell/browser/shell_browser_main.h" |
28 #include "content/shell/browser/shell_content_browser_client.h" | 28 #include "content/shell/browser/shell_content_browser_client.h" |
| 29 #include "content/shell/common/layout_test/layout_test_content_client.h" |
29 #include "content/shell/common/layout_test/layout_test_switches.h" | 30 #include "content/shell/common/layout_test/layout_test_switches.h" |
| 31 #include "content/shell/common/shell_content_client.h" |
30 #include "content/shell/common/shell_switches.h" | 32 #include "content/shell/common/shell_switches.h" |
31 #include "content/shell/renderer/layout_test/layout_test_content_renderer_client
.h" | 33 #include "content/shell/renderer/layout_test/layout_test_content_renderer_client
.h" |
32 #include "content/shell/renderer/shell_content_renderer_client.h" | 34 #include "content/shell/renderer/shell_content_renderer_client.h" |
33 #include "content/shell/utility/shell_content_utility_client.h" | 35 #include "content/shell/utility/shell_content_utility_client.h" |
34 #include "media/base/media_switches.h" | 36 #include "media/base/media_switches.h" |
35 #include "media/base/mime_util.h" | 37 #include "media/base/mime_util.h" |
36 #include "net/cookies/cookie_monster.h" | 38 #include "net/cookies/cookie_monster.h" |
37 #include "ui/base/resource/resource_bundle.h" | 39 #include "ui/base/resource/resource_bundle.h" |
38 #include "ui/base/ui_base_paths.h" | 40 #include "ui/base/ui_base_paths.h" |
39 #include "ui/base/ui_base_switches.h" | 41 #include "ui/base/ui_base_switches.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 // avoid removing MP4/H264/AAC so that layout tests can run on Android. | 206 // avoid removing MP4/H264/AAC so that layout tests can run on Android. |
205 #if !defined(OS_ANDROID) | 207 #if !defined(OS_ANDROID) |
206 media::RemoveProprietaryMediaTypesAndCodecsForTests(); | 208 media::RemoveProprietaryMediaTypesAndCodecsForTests(); |
207 #endif | 209 #endif |
208 | 210 |
209 if (!BlinkTestPlatformInitialize()) { | 211 if (!BlinkTestPlatformInitialize()) { |
210 *exit_code = 1; | 212 *exit_code = 1; |
211 return true; | 213 return true; |
212 } | 214 } |
213 } | 215 } |
214 SetContentClient(&content_client_); | 216 |
| 217 content_client_.reset(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 218 switches::kRunLayoutTest) |
| 219 ? new LayoutTestContentClient |
| 220 : new ShellContentClient); |
| 221 SetContentClient(content_client_.get()); |
| 222 |
215 return false; | 223 return false; |
216 } | 224 } |
217 | 225 |
218 void ShellMainDelegate::PreSandboxStartup() { | 226 void ShellMainDelegate::PreSandboxStartup() { |
219 #if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX)) | 227 #if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX)) |
220 // Create an instance of the CPU class to parse /proc/cpuinfo and cache | 228 // Create an instance of the CPU class to parse /proc/cpuinfo and cache |
221 // cpu_brand info. | 229 // cpu_brand info. |
222 base::CPU cpu_info; | 230 base::CPU cpu_info; |
223 #endif | 231 #endif |
224 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 232 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 | 359 |
352 return renderer_client_.get(); | 360 return renderer_client_.get(); |
353 } | 361 } |
354 | 362 |
355 ContentUtilityClient* ShellMainDelegate::CreateContentUtilityClient() { | 363 ContentUtilityClient* ShellMainDelegate::CreateContentUtilityClient() { |
356 utility_client_.reset(new ShellContentUtilityClient); | 364 utility_client_.reset(new ShellContentUtilityClient); |
357 return utility_client_.get(); | 365 return utility_client_.get(); |
358 } | 366 } |
359 | 367 |
360 } // namespace content | 368 } // namespace content |
OLD | NEW |