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 "chrome/test/base/chrome_test_launcher.h" | 5 #include "chrome/test/base/chrome_test_launcher.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/leak_annotations.h" | 8 #include "base/debug/leak_annotations.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
13 #include "base/process/process_metrics.h" | 13 #include "base/process/process_metrics.h" |
14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "base/test/test_file_util.h" | 16 #include "base/test/test_file_util.h" |
17 #include "chrome/app/chrome_main_delegate.h" | 17 #include "chrome/app/chrome_main_delegate.h" |
18 #include "chrome/common/chrome_constants.h" | 18 #include "chrome/common/chrome_constants.h" |
19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
20 #include "chrome/test/base/chrome_test_suite.h" | 20 #include "chrome/test/base/chrome_test_suite.h" |
21 #include "chrome/test/base/test_switches.h" | 21 #include "chrome/test/base/test_switches.h" |
| 22 #include "components/crash/content/app/crashpad.h" |
22 #include "content/public/app/content_main.h" | 23 #include "content/public/app/content_main.h" |
| 24 #include "content/public/common/content_switches.h" |
23 #include "content/public/test/test_launcher.h" | 25 #include "content/public/test/test_launcher.h" |
24 #include "content/public/test/test_utils.h" | 26 #include "content/public/test/test_utils.h" |
25 #include "ui/base/test/ui_controls.h" | 27 #include "ui/base/test/ui_controls.h" |
26 | 28 |
27 #if defined(OS_MACOSX) | 29 #if defined(OS_MACOSX) |
28 #include "chrome/browser/chrome_browser_application_mac.h" | 30 #include "chrome/browser/chrome_browser_application_mac.h" |
29 #endif // defined(OS_MACOSX) | 31 #endif // defined(OS_MACOSX) |
30 | 32 |
31 #if defined(USE_AURA) | 33 #if defined(USE_AURA) |
32 #include "ui/aura/test/ui_controls_factory_aura.h" | 34 #include "ui/aura/test/ui_controls_factory_aura.h" |
33 #include "ui/base/test/ui_controls_aura.h" | 35 #include "ui/base/test/ui_controls_aura.h" |
34 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 36 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
35 #include "ui/views/test/ui_controls_factory_desktop_aurax11.h" | 37 #include "ui/views/test/ui_controls_factory_desktop_aurax11.h" |
36 #endif | 38 #endif |
37 #endif | 39 #endif |
38 | 40 |
39 #if defined(OS_CHROMEOS) | 41 #if defined(OS_CHROMEOS) |
40 #include "ash/test/ui_controls_factory_ash.h" | 42 #include "ash/test/ui_controls_factory_ash.h" |
41 #endif | 43 #endif |
42 | 44 |
43 #if defined(OS_LINUX) || defined(OS_ANDROID) | 45 #if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WIN) |
44 #include "chrome/app/chrome_crash_reporter_client.h" | 46 #include "chrome/app/chrome_crash_reporter_client.h" |
45 #endif | 47 #endif |
46 | 48 |
47 namespace { | 49 namespace { |
48 | 50 |
49 class ChromeTestLauncherDelegate : public content::TestLauncherDelegate { | 51 class ChromeTestLauncherDelegate : public content::TestLauncherDelegate { |
50 public: | 52 public: |
51 explicit ChromeTestLauncherDelegate(ChromeTestSuiteRunner* runner) | 53 explicit ChromeTestLauncherDelegate(ChromeTestSuiteRunner* runner) |
52 : runner_(runner) {} | 54 : runner_(runner) {} |
53 ~ChromeTestLauncherDelegate() override {} | 55 ~ChromeTestLauncherDelegate() override {} |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } // namespace | 107 } // namespace |
106 | 108 |
107 int LaunchChromeTests(int default_jobs, | 109 int LaunchChromeTests(int default_jobs, |
108 ChromeTestSuiteRunner* runner, | 110 ChromeTestSuiteRunner* runner, |
109 int argc, | 111 int argc, |
110 char** argv) { | 112 char** argv) { |
111 #if defined(OS_MACOSX) | 113 #if defined(OS_MACOSX) |
112 chrome_browser_application_mac::RegisterBrowserCrApp(); | 114 chrome_browser_application_mac::RegisterBrowserCrApp(); |
113 #endif | 115 #endif |
114 | 116 |
115 #if defined(OS_LINUX) || defined(OS_ANDROID) | 117 #if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WIN) |
116 // We leak this pointer intentionally. The breakpad client needs to outlive | 118 // We leak this pointer intentionally. The crash client needs to outlive |
117 // all other code. | 119 // all other code. |
118 ChromeCrashReporterClient* crash_client = new ChromeCrashReporterClient(); | 120 ChromeCrashReporterClient* crash_client = new ChromeCrashReporterClient(); |
119 ANNOTATE_LEAKING_OBJECT_PTR(crash_client); | 121 ANNOTATE_LEAKING_OBJECT_PTR(crash_client); |
120 crash_reporter::SetCrashReporterClient(crash_client); | 122 crash_reporter::SetCrashReporterClient(crash_client); |
121 #endif | 123 #endif |
122 | 124 |
| 125 #if defined(OS_WIN) |
| 126 base::CommandLine::Init(0, nullptr); |
| 127 std::string process_type = |
| 128 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 129 switches::kProcessType); |
| 130 crash_reporter::InitializeCrashpad(process_type.empty(), process_type); |
| 131 #endif |
| 132 |
123 ChromeTestLauncherDelegate launcher_delegate(runner); | 133 ChromeTestLauncherDelegate launcher_delegate(runner); |
124 return content::LaunchTests(&launcher_delegate, default_jobs, argc, argv); | 134 return content::LaunchTests(&launcher_delegate, default_jobs, argc, argv); |
125 } | 135 } |
OLD | NEW |