Commit b99538b3 authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

Revert "Better registry cleanup in InstallServiceWorkItemTest."

This reverts commit b256ed1f.

Reason for revert: I'm hoping reverting this and your other patch will fix the flake. Bug is here: https://bugs.chromium.org/p/chromium/issues/detail?id=1059314

Original change's description:
> Better registry cleanup in InstallServiceWorkItemTest.
> 
> mini_installer_tests ChromeUserLevel and ChromeUserLevelUpdate are
> failing with the following error:
> 
> AssertionError: In state 'chrome_user_installed_not_inuse', Registry key
> HKEY_LOCAL_MACHINE\Software\Chromium exists.
> 
> This is most likely due to the change I made in change 2086353 to delete
> a value instead of the key.
> 
> Now the test will delete the key if the test is the one that created the
> key in the first place.
> 
> Bug: 1059314
> Change-Id: I2b85e1f4c979c52a41aebb41c4951b60cf58a50a
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2092939
> Commit-Queue: Greg Thompson <grt@chromium.org>
> Reviewed-by: Greg Thompson <grt@chromium.org>
> Auto-Submit: S. Ganesh <ganesh@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#748062}

TBR=ganesh@chromium.org,grt@chromium.org

Change-Id: I875c730322f5bc4cc9fdfa8b5497e26f2b8b81da
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1059314
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2095201Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748256}
parent 26ded05d
...@@ -42,34 +42,6 @@ class InstallServiceWorkItemTest : public ::testing::Test { ...@@ -42,34 +42,6 @@ class InstallServiceWorkItemTest : public ::testing::Test {
return GetImpl(item)->IsServiceCorrectlyConfigured(config); return GetImpl(item)->IsServiceCorrectlyConfigured(config);
} }
void SetUp() override {
base::win::RegKey key;
if (ERROR_SUCCESS ==
key.Open(HKEY_LOCAL_MACHINE,
install_static::GetClientStateKeyPath().c_str(),
KEY_READ | KEY_WOW64_32KEY)) {
preexisting_clientstate_key_ = true;
} else {
ASSERT_EQ(ERROR_SUCCESS,
key.Create(HKEY_LOCAL_MACHINE,
install_static::GetClientStateKeyPath().c_str(),
KEY_READ | KEY_WOW64_32KEY));
}
}
void TearDown() override {
if (!preexisting_clientstate_key_) {
base::win::RegKey key;
if (key.Open(HKEY_LOCAL_MACHINE,
install_static::GetClientStateKeyPath().c_str(),
DELETE | KEY_WOW64_32KEY)) {
EXPECT_EQ(ERROR_SUCCESS, key.DeleteKey(L""));
}
}
}
bool preexisting_clientstate_key_ = false;
}; };
TEST_F(InstallServiceWorkItemTest, Do_MultiSzToVector) { TEST_F(InstallServiceWorkItemTest, Do_MultiSzToVector) {
...@@ -162,6 +134,12 @@ TEST_F(InstallServiceWorkItemTest, Do_UpgradeChangedCmdLine) { ...@@ -162,6 +134,12 @@ TEST_F(InstallServiceWorkItemTest, Do_UpgradeChangedCmdLine) {
} }
TEST_F(InstallServiceWorkItemTest, Do_ServiceName) { TEST_F(InstallServiceWorkItemTest, Do_ServiceName) {
base::win::RegKey key;
ASSERT_EQ(ERROR_SUCCESS,
key.Create(HKEY_LOCAL_MACHINE,
install_static::GetClientStateKeyPath().c_str(),
KEY_WRITE | KEY_WOW64_32KEY));
key.DeleteValue(kServiceName);
auto item = std::make_unique<InstallServiceWorkItem>( auto item = std::make_unique<InstallServiceWorkItem>(
kServiceName, kServiceDisplayName, kServiceName, kServiceDisplayName,
base::CommandLine(base::FilePath(kServiceProgramPath))); base::CommandLine(base::FilePath(kServiceProgramPath)));
...@@ -185,11 +163,6 @@ TEST_F(InstallServiceWorkItemTest, Do_ServiceName) { ...@@ -185,11 +163,6 @@ TEST_F(InstallServiceWorkItemTest, Do_ServiceName) {
.c_str(), .c_str(),
GetImpl(item.get())->GetCurrentServiceDisplayName().c_str()); GetImpl(item.get())->GetCurrentServiceDisplayName().c_str());
base::win::RegKey key;
ASSERT_EQ(ERROR_SUCCESS,
key.Open(HKEY_LOCAL_MACHINE,
install_static::GetClientStateKeyPath().c_str(),
KEY_WRITE | KEY_WOW64_32KEY));
EXPECT_EQ(ERROR_SUCCESS, key.DeleteValue(kServiceName)); EXPECT_EQ(ERROR_SUCCESS, key.DeleteValue(kServiceName));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment