@@ -49,8 +49,13 @@ namespace chrome_cleaner {
49
49
50
50
namespace {
51
51
52
- class ServiceUtilCleanerTest : public testing ::Test {
52
+ class ServiceUtilCleanerRunningServiceTest : public testing ::Test {
53
53
public:
54
+ static void SetUpTestCase () {
55
+ // Tests calling StartService() need this.
56
+ ASSERT_TRUE (chrome_cleaner::ResetAclForUcrtbase ());
57
+ }
58
+
54
59
void SetUp () override {
55
60
// Cleanup previous run. This may happen when previous execution of unittest
56
61
// crashed, leaving background processes/services.
@@ -74,7 +79,7 @@ TEST(SystemUtilCleanerTests, OpenRegistryKeyWithInvalidParameter) {
74
79
EXPECT_FALSE (key_path.Open (KEY_READ, &key));
75
80
}
76
81
77
- TEST_F (ServiceUtilCleanerTest , DeleteService) {
82
+ TEST_F (ServiceUtilCleanerRunningServiceTest , DeleteService) {
78
83
TestScopedServiceHandle service_handle;
79
84
ASSERT_TRUE (service_handle.InstallService ());
80
85
service_handle.Close ();
@@ -85,8 +90,7 @@ TEST_F(ServiceUtilCleanerTest, DeleteService) {
85
90
EXPECT_FALSE (DoesServiceExist (service_handle.service_name ()));
86
91
}
87
92
88
- // Disabled: https://crbug.com/956016
89
- TEST_F (ServiceUtilCleanerTest, DISABLED_StopAndDeleteRunningService) {
93
+ TEST_F (ServiceUtilCleanerRunningServiceTest, StopAndDeleteRunningService) {
90
94
// Install and launch the service.
91
95
TestScopedServiceHandle service_handle;
92
96
ASSERT_TRUE (service_handle.InstallService ());
@@ -109,8 +113,7 @@ TEST_F(ServiceUtilCleanerTest, DISABLED_StopAndDeleteRunningService) {
109
113
EXPECT_FALSE (IsProcessRunning (kTestServiceExecutableName ));
110
114
}
111
115
112
- // Disabled: https://crbug.com/956016
113
- TEST_F (ServiceUtilCleanerTest, DISABLED_DeleteRunningService) {
116
+ TEST_F (ServiceUtilCleanerRunningServiceTest, DeleteRunningService) {
114
117
// Install and launch the service.
115
118
TestScopedServiceHandle service_handle;
116
119
ASSERT_TRUE (service_handle.InstallService ());
@@ -128,7 +131,7 @@ TEST_F(ServiceUtilCleanerTest, DISABLED_DeleteRunningService) {
128
131
EXPECT_FALSE (IsProcessRunning (kTestServiceExecutableName ));
129
132
}
130
133
131
- TEST_F (ServiceUtilCleanerTest , QuarantineFolderPermission) {
134
+ TEST_F (ServiceUtilCleanerRunningServiceTest , QuarantineFolderPermission) {
132
135
base::ScopedPathOverride local_app_data_override (
133
136
CsidlToPathServiceKey (CSIDL_LOCAL_APPDATA));
134
137
@@ -174,7 +177,7 @@ TEST_F(ServiceUtilCleanerTest, QuarantineFolderPermission) {
174
177
::LocalFree (security_descriptor);
175
178
}
176
179
177
- TEST_F (ServiceUtilCleanerTest , DefaultQuarantineFolderPath) {
180
+ TEST_F (ServiceUtilCleanerRunningServiceTest , DefaultQuarantineFolderPath) {
178
181
base::ScopedPathOverride local_app_data_override (
179
182
CsidlToPathServiceKey (CSIDL_LOCAL_APPDATA));
180
183
@@ -187,7 +190,7 @@ TEST_F(ServiceUtilCleanerTest, DefaultQuarantineFolderPath) {
187
190
EXPECT_EQ (quarantine_path, default_path);
188
191
}
189
192
190
- TEST_F (ServiceUtilCleanerTest , SpecifiedQuarantineFolderPath) {
193
+ TEST_F (ServiceUtilCleanerRunningServiceTest , SpecifiedQuarantineFolderPath) {
191
194
// Override the default path of local appdata, so if we fail to redirect the
192
195
// quarantine folder, the test won't drop any file in the real directory.
193
196
base::ScopedPathOverride local_app_data_override (
0 commit comments