| 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> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 #if defined(OS_WIN) | 109 #if defined(OS_WIN) |
| 110 // Pre-test cleanup for registry state keyed off the profile dir (which can | 110 // Pre-test cleanup for registry state keyed off the profile dir (which can |
| 111 // proliferate with the use of uniquely named scoped_dirs): | 111 // proliferate with the use of uniquely named scoped_dirs): |
| 112 // https://crbug.com/721245. This needs to be here in order not to be racy | 112 // https://crbug.com/721245. This needs to be here in order not to be racy |
| 113 // with any tests that will access that state. | 113 // with any tests that will access that state. |
| 114 base::win::RegKey distrubution_key; | 114 base::win::RegKey distrubution_key; |
| 115 LONG result = distrubution_key.Open(HKEY_CURRENT_USER, | 115 LONG result = distrubution_key.Open(HKEY_CURRENT_USER, |
| 116 install_static::GetRegistryPath().c_str(), | 116 install_static::GetRegistryPath().c_str(), |
| 117 KEY_SET_VALUE); | 117 KEY_SET_VALUE); |
| 118 | 118 |
| 119 if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND) { | 119 if (result != ERROR_SUCCESS) { |
| 120 LOG(ERROR) << "Failed to open distribution key for cleanup: " << result; | 120 LOG_IF(ERROR, result != ERROR_FILE_NOT_FOUND) |
| 121 << "Failed to open distribution key for cleanup: " << result; |
| 121 return; | 122 return; |
| 122 } | 123 } |
| 123 | 124 |
| 124 result = distrubution_key.DeleteKey(L"PreferenceMACs"); | 125 result = distrubution_key.DeleteKey(L"PreferenceMACs"); |
| 125 | 126 LOG_IF(ERROR, result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND) |
| 126 if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND) { | 127 << "Failed to cleanup PreferenceMACs: " << result; |
| 127 LOG(ERROR) << "Failed to cleanup PreferenceMACs: " << result; | |
| 128 return; | |
| 129 } | |
| 130 #endif | 128 #endif |
| 131 } | 129 } |
| 132 | 130 |
| 133 int LaunchChromeTests(int default_jobs, | 131 int LaunchChromeTests(int default_jobs, |
| 134 content::TestLauncherDelegate* delegate, | 132 content::TestLauncherDelegate* delegate, |
| 135 int argc, | 133 int argc, |
| 136 char** argv) { | 134 char** argv) { |
| 137 #if defined(OS_MACOSX) | 135 #if defined(OS_MACOSX) |
| 138 chrome_browser_application_mac::RegisterBrowserCrApp(); | 136 chrome_browser_application_mac::RegisterBrowserCrApp(); |
| 139 #endif | 137 #endif |
| 140 | 138 |
| 141 #if defined(OS_WIN) | 139 #if defined(OS_WIN) |
| 142 // Create a primordial InstallDetails instance for the test. | 140 // Create a primordial InstallDetails instance for the test. |
| 143 install_static::ScopedInstallDetails install_details; | 141 install_static::ScopedInstallDetails install_details; |
| 144 #endif | 142 #endif |
| 145 | 143 |
| 146 #if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WIN) | 144 #if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WIN) |
| 147 // We leak this pointer intentionally. The crash client needs to outlive | 145 // We leak this pointer intentionally. The crash client needs to outlive |
| 148 // all other code. | 146 // all other code. |
| 149 ChromeCrashReporterClient* crash_client = new ChromeCrashReporterClient(); | 147 ChromeCrashReporterClient* crash_client = new ChromeCrashReporterClient(); |
| 150 ANNOTATE_LEAKING_OBJECT_PTR(crash_client); | 148 ANNOTATE_LEAKING_OBJECT_PTR(crash_client); |
| 151 crash_reporter::SetCrashReporterClient(crash_client); | 149 crash_reporter::SetCrashReporterClient(crash_client); |
| 152 #endif | 150 #endif |
| 153 | 151 |
| 154 return content::LaunchTests(delegate, default_jobs, argc, argv); | 152 return content::LaunchTests(delegate, default_jobs, argc, argv); |
| 155 } | 153 } |
| OLD | NEW |