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