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 <memory> | |
8 #include <utility> | |
9 | |
10 #include "base/command_line.h" | 7 #include "base/command_line.h" |
11 #include "base/debug/leak_annotations.h" | 8 #include "base/debug/leak_annotations.h" |
12 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
13 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
14 #include "base/logging.h" | 11 #include "base/logging.h" |
15 #include "base/macros.h" | 12 #include "base/macros.h" |
16 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
17 #include "base/memory/ptr_util.h" | |
18 #include "base/process/process_metrics.h" | 14 #include "base/process/process_metrics.h" |
19 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
20 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
21 #include "base/test/test_file_util.h" | 17 #include "base/test/test_file_util.h" |
22 #include "build/build_config.h" | 18 #include "build/build_config.h" |
23 #include "chrome/app/chrome_main_delegate.h" | 19 #include "chrome/app/chrome_main_delegate.h" |
24 #include "chrome/common/chrome_constants.h" | 20 #include "chrome/common/chrome_constants.h" |
25 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
26 #include "chrome/install_static/install_details.h" | |
27 #include "chrome/install_static/install_modes.h" | |
28 #include "chrome/test/base/chrome_test_suite.h" | 22 #include "chrome/test/base/chrome_test_suite.h" |
29 #include "components/crash/content/app/crashpad.h" | 23 #include "components/crash/content/app/crashpad.h" |
30 #include "content/public/app/content_main.h" | 24 #include "content/public/app/content_main.h" |
31 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
32 #include "content/public/test/test_launcher.h" | 26 #include "content/public/test/test_launcher.h" |
33 #include "content/public/test/test_utils.h" | 27 #include "content/public/test/test_utils.h" |
34 #include "ui/base/test/ui_controls.h" | 28 #include "ui/base/test/ui_controls.h" |
35 | 29 |
36 #if defined(OS_MACOSX) | 30 #if defined(OS_MACOSX) |
37 #include "chrome/browser/chrome_browser_application_mac.h" | 31 #include "chrome/browser/chrome_browser_application_mac.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 } | 96 } |
103 | 97 |
104 int LaunchChromeTests(int default_jobs, | 98 int LaunchChromeTests(int default_jobs, |
105 content::TestLauncherDelegate* delegate, | 99 content::TestLauncherDelegate* delegate, |
106 int argc, | 100 int argc, |
107 char** argv) { | 101 char** argv) { |
108 #if defined(OS_MACOSX) | 102 #if defined(OS_MACOSX) |
109 chrome_browser_application_mac::RegisterBrowserCrApp(); | 103 chrome_browser_application_mac::RegisterBrowserCrApp(); |
110 #endif | 104 #endif |
111 | 105 |
112 #if defined(OS_WIN) | |
113 // Create a primordial InstallDetails instance for the test. | |
114 std::unique_ptr<install_static::PrimaryInstallDetails> install_details = | |
115 base::MakeUnique<install_static::PrimaryInstallDetails>(); | |
116 install_details->set_mode(&install_static::kInstallModes[0]); | |
117 install_details->set_channel( | |
118 install_static::kInstallModes[0].default_channel_name); | |
119 install_static::InstallDetails::SetForProcess(std::move(install_details)); | |
120 #endif | |
121 | |
122 #if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WIN) | 106 #if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WIN) |
123 // We leak this pointer intentionally. The crash client needs to outlive | 107 // We leak this pointer intentionally. The crash client needs to outlive |
124 // all other code. | 108 // all other code. |
125 ChromeCrashReporterClient* crash_client = new ChromeCrashReporterClient(); | 109 ChromeCrashReporterClient* crash_client = new ChromeCrashReporterClient(); |
126 ANNOTATE_LEAKING_OBJECT_PTR(crash_client); | 110 ANNOTATE_LEAKING_OBJECT_PTR(crash_client); |
127 crash_reporter::SetCrashReporterClient(crash_client); | 111 crash_reporter::SetCrashReporterClient(crash_client); |
128 #endif | 112 #endif |
129 | 113 |
130 return content::LaunchTests(delegate, default_jobs, argc, argv); | 114 return content::LaunchTests(delegate, default_jobs, argc, argv); |
131 } | 115 } |
OLD | NEW |