Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(492)

Side by Side Diff: chrome/test/base/chrome_test_launcher.cc

Issue 2893703002: Cleanup PreferenceMACs on browser_tests startup (Closed)
Patch Set: re-enable PrefHashBrowserTests disabled for this issue Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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::PreShardingCleanup() {
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");
jam 2017/05/17 19:06:16 does this mean that if someone runs official brows
gab 2017/05/17 20:01:05 Yes, but it's not that bad (discussed details offl
112 }
113 #endif
114 }
115
99 int LaunchChromeTests(int default_jobs, 116 int LaunchChromeTests(int default_jobs,
100 content::TestLauncherDelegate* delegate, 117 content::TestLauncherDelegate* delegate,
101 int argc, 118 int argc,
102 char** argv) { 119 char** argv) {
103 #if defined(OS_MACOSX) 120 #if defined(OS_MACOSX)
104 chrome_browser_application_mac::RegisterBrowserCrApp(); 121 chrome_browser_application_mac::RegisterBrowserCrApp();
105 #endif 122 #endif
106 123
107 #if defined(OS_WIN) 124 #if defined(OS_WIN)
108 // Create a primordial InstallDetails instance for the test. 125 // Create a primordial InstallDetails instance for the test.
109 install_static::ScopedInstallDetails install_details; 126 install_static::ScopedInstallDetails install_details;
110 #endif 127 #endif
111 128
112 #if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WIN) 129 #if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WIN)
113 // We leak this pointer intentionally. The crash client needs to outlive 130 // We leak this pointer intentionally. The crash client needs to outlive
114 // all other code. 131 // all other code.
115 ChromeCrashReporterClient* crash_client = new ChromeCrashReporterClient(); 132 ChromeCrashReporterClient* crash_client = new ChromeCrashReporterClient();
116 ANNOTATE_LEAKING_OBJECT_PTR(crash_client); 133 ANNOTATE_LEAKING_OBJECT_PTR(crash_client);
117 crash_reporter::SetCrashReporterClient(crash_client); 134 crash_reporter::SetCrashReporterClient(crash_client);
118 #endif 135 #endif
119 136
120 return content::LaunchTests(delegate, default_jobs, argc, argv); 137 return content::LaunchTests(delegate, default_jobs, argc, argv);
121 } 138 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698