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

Unified Diff: chrome/test/base/chrome_test_launcher.cc

Issue 2897483003: Attempt #3 at registry outage: ShellExecute reg delete (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/chrome_test_launcher.cc
diff --git a/chrome/test/base/chrome_test_launcher.cc b/chrome/test/base/chrome_test_launcher.cc
index 2b51be94a9121f41d34d4543e50d0237b6653c1b..3bd57a6a582b0343906ef5b14082b9c420317e92 100644
--- a/chrome/test/base/chrome_test_launcher.cc
+++ b/chrome/test/base/chrome_test_launcher.cc
@@ -16,6 +16,7 @@
#include "base/memory/ptr_util.h"
#include "base/process/process_metrics.h"
#include "base/run_loop.h"
+#include "base/strings/string16.h"
#include "base/strings/string_util.h"
#include "base/test/test_file_util.h"
#include "build/build_config.h"
@@ -52,6 +53,7 @@
#endif
#if defined(OS_WIN)
+#include <shellapi.h>
#include "base/win/registry.h"
#include "chrome/app/chrome_crash_reporter_client_win.h"
#include "chrome/install_static/install_util.h"
@@ -100,26 +102,37 @@ ChromeTestLauncherDelegate::CreateContentMainDelegate() {
void ChromeTestLauncherDelegate::PreSharding() {
#if defined(OS_WIN)
- // Pre-test cleanup for registry state keyed off the profile dir (which can
- // proliferate with the use of uniquely named scoped_dirs):
- // https://crbug.com/721245. This needs to be here in order not to be racy
- // with any tests that will access that state.
- base::win::RegKey distrubution_key;
- LONG result = distrubution_key.Open(HKEY_CURRENT_USER,
- install_static::GetRegistryPath().c_str(),
- KEY_SET_VALUE);
-
- if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND) {
- LOG(ERROR) << "Failed to open distribution key for cleanup: " << result;
- return;
- }
-
- result = distrubution_key.DeleteKey(L"PreferenceMACs");
-
- if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND) {
- LOG(ERROR) << "Failed to cleanup PreferenceMACs: " << result;
- return;
- }
+ // Construct the distribution specific equivalent of
+ // "delete HKCU\\SOFTWARE\\Chromium\\PreferenceMACs /f".
+ base::string16 operation(L"delete HKCU\\");
+ operation.append(install_static::GetRegistryPath());
+ operation.append(L"\\PreferenceMACs /f");
+ // TODO(gab): This is a nuclear option while the cleanup below doesn't work as
+ // the bots are in such bad shape per https://crbug.com/721245 that doing any
+ // registry operations from C++ results in fatal error 1450 (insufficient
+ // resources). Hopefully ShellExecute works...
+ ::ShellExecute(NULL, NULL, L"reg.exe", operation.c_str(), NULL, 0);
+
+// // Pre-test cleanup for registry state keyed off the profile dir (which can
+// // proliferate with the use of uniquely named scoped_dirs):
+// // https://crbug.com/721245. This needs to be here in order not to be racy
+// // with any tests that will access that state.
+// base::win::RegKey distrubution_key;
+// LONG result = distrubution_key.Open(
+// HKEY_CURRENT_USER, install_static::GetRegistryPath().c_str(),
+// KEY_SET_VALUE);
+
+// if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND) {
+// LOG(ERROR) << "Failed to open distribution key for cleanup: " << result;
+// return;
+// }
+
+// result = distrubution_key.DeleteKey(L"PreferenceMACs");
+
+// if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND) {
+// LOG(ERROR) << "Failed to cleanup PreferenceMACs: " << result;
+// return;
+// }
#endif
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698