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/installer/setup/setup_util_unittest.h" | 5 #include "chrome/installer/setup/setup_util_unittest.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <shlobj.h> | 8 #include <shlobj.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 } | 186 } |
187 | 187 |
188 ASSERT_FALSE(CurrentProcessHasPrivilege(kTestedPrivilege)); | 188 ASSERT_FALSE(CurrentProcessHasPrivilege(kTestedPrivilege)); |
189 } | 189 } |
190 | 190 |
191 TEST(SetupUtilTest, GuidToSquid) { | 191 TEST(SetupUtilTest, GuidToSquid) { |
192 ASSERT_EQ(installer::GuidToSquid(L"EDA620E3-AA98-3846-B81E-3493CB2E0E02"), | 192 ASSERT_EQ(installer::GuidToSquid(L"EDA620E3-AA98-3846-B81E-3493CB2E0E02"), |
193 L"3E026ADE89AA64838BE14339BCE2E020"); | 193 L"3E026ADE89AA64838BE14339BCE2E020"); |
194 } | 194 } |
195 | 195 |
196 TEST(SetupUtilTest, RegisterEventLogProvider) { | |
197 registry_util::RegistryOverrideManager registry_override_manager; | |
198 registry_override_manager.OverrideRegistry(HKEY_LOCAL_MACHINE); | |
199 | |
200 base::FilePath install_directory(FILE_PATH_LITERAL("c:\\some_path\\test")); | |
201 installer::RegisterEventLogProvider(install_directory, "1.2.3.4"); | |
202 | |
203 base::win::RegKey key; | |
204 static constexpr wchar_t kRegistryLocation[] = | |
205 L"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\chrome"; | |
206 ASSERT_EQ(ERROR_SUCCESS, | |
207 key.Open(HKEY_LOCAL_MACHINE, kRegistryLocation, KEY_READ)); | |
208 EXPECT_TRUE(key.HasValue(L"CategoryCount")); | |
209 EXPECT_TRUE(key.HasValue(L"TypesSupported")); | |
210 EXPECT_TRUE(key.HasValue(L"CategoryMessageFile")); | |
grt (UTC plus 2)
2016/11/24 07:49:34
please add an expectation that the path was compos
pastarmovj
2016/11/24 09:51:09
Done.
| |
211 EXPECT_TRUE(key.HasValue(L"EventMessageFile")); | |
212 EXPECT_TRUE(key.HasValue(L"ParameterMessageFile")); | |
213 key.Close(); | |
214 | |
215 installer::DeRegisterEventLogProvider(); | |
216 | |
217 EXPECT_NE(ERROR_SUCCESS, | |
218 key.Open(HKEY_LOCAL_MACHINE, kRegistryLocation, KEY_READ)); | |
219 } | |
220 | |
196 const char kAdjustProcessPriority[] = "adjust-process-priority"; | 221 const char kAdjustProcessPriority[] = "adjust-process-priority"; |
197 | 222 |
198 PriorityClassChangeResult DoProcessPriorityAdjustment() { | 223 PriorityClassChangeResult DoProcessPriorityAdjustment() { |
199 return installer::AdjustProcessPriority() ? PCCR_CHANGED : PCCR_UNCHANGED; | 224 return installer::AdjustProcessPriority() ? PCCR_CHANGED : PCCR_UNCHANGED; |
200 } | 225 } |
201 | 226 |
202 namespace { | 227 namespace { |
203 | 228 |
204 // A scoper that sets/resets the current process's priority class. | 229 // A scoper that sets/resets the current process's priority class. |
205 class ScopedPriorityClass { | 230 class ScopedPriorityClass { |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
669 } | 694 } |
670 | 695 |
671 // Ensure that all values are absent. | 696 // Ensure that all values are absent. |
672 { | 697 { |
673 base::win::RegistryValueIterator it(root_, path_.c_str()); | 698 base::win::RegistryValueIterator it(root_, path_.c_str()); |
674 ASSERT_EQ(0u, it.ValueCount()); | 699 ASSERT_EQ(0u, it.ValueCount()); |
675 } | 700 } |
676 } | 701 } |
677 | 702 |
678 } // namespace installer | 703 } // namespace installer |
OLD | NEW |