Chromium Code Reviews| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 | 45 |
| 46 #if defined(OS_CHROMEOS) | 46 #if defined(OS_CHROMEOS) |
| 47 #include "ash/test/ui_controls_factory_ash.h" | 47 #include "ash/test/ui_controls_factory_ash.h" |
| 48 #endif | 48 #endif |
| 49 | 49 |
| 50 #if defined(OS_LINUX) || defined(OS_ANDROID) | 50 #if defined(OS_LINUX) || defined(OS_ANDROID) |
| 51 #include "chrome/app/chrome_crash_reporter_client.h" | 51 #include "chrome/app/chrome_crash_reporter_client.h" |
| 52 #endif | 52 #endif |
| 53 | 53 |
| 54 #if defined(OS_WIN) | 54 #if defined(OS_WIN) |
| 55 #include "base/win/registry.h" | |
| 55 #include "chrome/app/chrome_crash_reporter_client_win.h" | 56 #include "chrome/app/chrome_crash_reporter_client_win.h" |
| 57 #include "chrome/install_static/install_util.h" | |
| 56 #endif | 58 #endif |
| 57 | 59 |
| 58 ChromeTestSuiteRunner::ChromeTestSuiteRunner() {} | 60 ChromeTestSuiteRunner::ChromeTestSuiteRunner() {} |
| 59 ChromeTestSuiteRunner::~ChromeTestSuiteRunner() {} | 61 ChromeTestSuiteRunner::~ChromeTestSuiteRunner() {} |
| 60 | 62 |
| 61 int ChromeTestSuiteRunner::RunTestSuite(int argc, char** argv) { | 63 int ChromeTestSuiteRunner::RunTestSuite(int argc, char** argv) { |
| 62 return ChromeTestSuite(argc, argv).Run(); | 64 return ChromeTestSuite(argc, argv).Run(); |
| 63 } | 65 } |
| 64 | 66 |
| 65 ChromeTestLauncherDelegate::ChromeTestLauncherDelegate( | 67 ChromeTestLauncherDelegate::ChromeTestLauncherDelegate( |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 89 | 91 |
| 90 *command_line = new_command_line; | 92 *command_line = new_command_line; |
| 91 return true; | 93 return true; |
| 92 } | 94 } |
| 93 | 95 |
| 94 content::ContentMainDelegate* | 96 content::ContentMainDelegate* |
| 95 ChromeTestLauncherDelegate::CreateContentMainDelegate() { | 97 ChromeTestLauncherDelegate::CreateContentMainDelegate() { |
| 96 return new ChromeMainDelegate(); | 98 return new ChromeMainDelegate(); |
| 97 } | 99 } |
| 98 | 100 |
| 101 void ChromeTestLauncherDelegate::PreSharding() { | |
| 102 #if defined(OS_WIN) | |
| 103 // Pre-test cleanup for registry state keyed off the profile dir (which can | |
| 104 // proliferate with the use of uniquely named scoped_dirs): | |
| 105 // https://crbug.com/721245. This needs to be here in order not to be racy | |
| 106 // with any tests that will access that state. | |
| 107 base::win::RegKey key(HKEY_CURRENT_USER, | |
| 108 install_static::GetRegistryPath().c_str(), | |
| 109 KEY_SET_VALUE | KEY_QUERY_VALUE); | |
| 110 if (key.Valid()) | |
| 111 key.DeleteKey(L"PreferenceMACs"); | |
|
grt (UTC plus 2)
2017/05/17 20:52:47
for devs like me who use Google Chrome and build G
gab
2017/05/17 20:57:37
Right.
| |
| 112 #endif | |
| 113 } | |
| 114 | |
| 99 int LaunchChromeTests(int default_jobs, | 115 int LaunchChromeTests(int default_jobs, |
| 100 content::TestLauncherDelegate* delegate, | 116 content::TestLauncherDelegate* delegate, |
| 101 int argc, | 117 int argc, |
| 102 char** argv) { | 118 char** argv) { |
| 103 #if defined(OS_MACOSX) | 119 #if defined(OS_MACOSX) |
| 104 chrome_browser_application_mac::RegisterBrowserCrApp(); | 120 chrome_browser_application_mac::RegisterBrowserCrApp(); |
| 105 #endif | 121 #endif |
| 106 | 122 |
| 107 #if defined(OS_WIN) | 123 #if defined(OS_WIN) |
| 108 // Create a primordial InstallDetails instance for the test. | 124 // Create a primordial InstallDetails instance for the test. |
| 109 install_static::ScopedInstallDetails install_details; | 125 install_static::ScopedInstallDetails install_details; |
| 110 #endif | 126 #endif |
| 111 | 127 |
| 112 #if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WIN) | 128 #if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WIN) |
| 113 // We leak this pointer intentionally. The crash client needs to outlive | 129 // We leak this pointer intentionally. The crash client needs to outlive |
| 114 // all other code. | 130 // all other code. |
| 115 ChromeCrashReporterClient* crash_client = new ChromeCrashReporterClient(); | 131 ChromeCrashReporterClient* crash_client = new ChromeCrashReporterClient(); |
| 116 ANNOTATE_LEAKING_OBJECT_PTR(crash_client); | 132 ANNOTATE_LEAKING_OBJECT_PTR(crash_client); |
| 117 crash_reporter::SetCrashReporterClient(crash_client); | 133 crash_reporter::SetCrashReporterClient(crash_client); |
| 118 #endif | 134 #endif |
| 119 | 135 |
| 120 return content::LaunchTests(delegate, default_jobs, argc, argv); | 136 return content::LaunchTests(delegate, default_jobs, argc, argv); |
| 121 } | 137 } |
| OLD | NEW |