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); | |
202 | |
203 base::win::RegKey key; | |
204 constexpr wchar_t registry_location[] = | |
grt (UTC plus 2)
2016/11/22 10:41:25
nit: static constexpr wchar_t kRegistryLocation[]
pastarmovj
2016/11/23 14:27:26
Done.
| |
205 L"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\chrome"; | |
206 ASSERT_EQ(ERROR_SUCCESS, | |
207 key.Open(HKEY_LOCAL_MACHINE, registry_location, KEY_READ)); | |
208 ASSERT_TRUE(key.HasValue(L"CategoryCount")); | |
grt (UTC plus 2)
2016/11/22 10:41:25
nit: make these all EXPECT_TRUE so that the test w
pastarmovj
2016/11/23 14:27:26
Done. Fell in the copy/paste trap here :)
| |
209 ASSERT_TRUE(key.HasValue(L"TypesSupported")); | |
210 ASSERT_TRUE(key.HasValue(L"CategoryMessageFile")); | |
211 ASSERT_TRUE(key.HasValue(L"EventMessageFile")); | |
212 ASSERT_TRUE(key.HasValue(L"ParameterMessageFile")); | |
213 key.Close(); | |
214 | |
215 installer::DeRegisterEventLogProvider(); | |
216 | |
217 ASSERT_NE(ERROR_SUCCESS, | |
grt (UTC plus 2)
2016/11/22 10:41:25
this could be EXPECT_NE as well
pastarmovj
2016/11/23 14:27:26
Done.
| |
218 key.Open(HKEY_LOCAL_MACHINE, registry_location, KEY_READ)); | |
219 } | |
220 | |
221 | |
196 const char kAdjustProcessPriority[] = "adjust-process-priority"; | 222 const char kAdjustProcessPriority[] = "adjust-process-priority"; |
197 | 223 |
198 PriorityClassChangeResult DoProcessPriorityAdjustment() { | 224 PriorityClassChangeResult DoProcessPriorityAdjustment() { |
199 return installer::AdjustProcessPriority() ? PCCR_CHANGED : PCCR_UNCHANGED; | 225 return installer::AdjustProcessPriority() ? PCCR_CHANGED : PCCR_UNCHANGED; |
200 } | 226 } |
201 | 227 |
202 namespace { | 228 namespace { |
203 | 229 |
204 // A scoper that sets/resets the current process's priority class. | 230 // A scoper that sets/resets the current process's priority class. |
205 class ScopedPriorityClass { | 231 class ScopedPriorityClass { |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
669 } | 695 } |
670 | 696 |
671 // Ensure that all values are absent. | 697 // Ensure that all values are absent. |
672 { | 698 { |
673 base::win::RegistryValueIterator it(root_, path_.c_str()); | 699 base::win::RegistryValueIterator it(root_, path_.c_str()); |
674 ASSERT_EQ(0u, it.ValueCount()); | 700 ASSERT_EQ(0u, it.ValueCount()); |
675 } | 701 } |
676 } | 702 } |
677 | 703 |
678 } // namespace installer | 704 } // namespace installer |
OLD | NEW |