| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef BASE_TEST_TEST_REG_UTIL_WIN_H_ | 5 #ifndef BASE_TEST_TEST_REG_UTIL_WIN_H_ |
| 6 #define BASE_TEST_TEST_REG_UTIL_WIN_H_ | 6 #define BASE_TEST_TEST_REG_UTIL_WIN_H_ |
| 7 | 7 |
| 8 // Registry utility functions used only by tests. | 8 // Registry utility functions used only by tests. |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // - A GUID used for preventing name collisions (although unlikely) between | 31 // - A GUID used for preventing name collisions (although unlikely) between |
| 32 // two RegistryOverrideManagers created with the same timestamp. | 32 // two RegistryOverrideManagers created with the same timestamp. |
| 33 class RegistryOverrideManager { | 33 class RegistryOverrideManager { |
| 34 public: | 34 public: |
| 35 RegistryOverrideManager(); | 35 RegistryOverrideManager(); |
| 36 ~RegistryOverrideManager(); | 36 ~RegistryOverrideManager(); |
| 37 | 37 |
| 38 // Override the given registry hive using a randomly generated temporary key. | 38 // Override the given registry hive using a randomly generated temporary key. |
| 39 // Multiple overrides to the same hive are not supported and lead to undefined | 39 // Multiple overrides to the same hive are not supported and lead to undefined |
| 40 // behavior. | 40 // behavior. |
| 41 // Optional return of the registry override path. |
| 41 void OverrideRegistry(HKEY override); | 42 void OverrideRegistry(HKEY override); |
| 43 void OverrideRegistry(HKEY override, base::string16* override_path); |
| 42 | 44 |
| 43 private: | 45 private: |
| 44 friend class RegistryOverrideManagerTest; | 46 friend class RegistryOverrideManagerTest; |
| 45 | 47 |
| 46 // Keeps track of one override. | 48 // Keeps track of one override. |
| 47 class ScopedRegistryKeyOverride { | 49 class ScopedRegistryKeyOverride { |
| 48 public: | 50 public: |
| 49 ScopedRegistryKeyOverride(HKEY override, const base::string16& key_path); | 51 ScopedRegistryKeyOverride(HKEY override, const base::string16& key_path); |
| 50 ~ScopedRegistryKeyOverride(); | 52 ~ScopedRegistryKeyOverride(); |
| 51 | 53 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 69 DISALLOW_COPY_AND_ASSIGN(RegistryOverrideManager); | 71 DISALLOW_COPY_AND_ASSIGN(RegistryOverrideManager); |
| 70 }; | 72 }; |
| 71 | 73 |
| 72 // Generates a temporary key path that will be eventually deleted | 74 // Generates a temporary key path that will be eventually deleted |
| 73 // automatically if the process crashes. | 75 // automatically if the process crashes. |
| 74 base::string16 GenerateTempKeyPath(); | 76 base::string16 GenerateTempKeyPath(); |
| 75 | 77 |
| 76 } // namespace registry_util | 78 } // namespace registry_util |
| 77 | 79 |
| 78 #endif // BASE_TEST_TEST_REG_UTIL_WIN_H_ | 80 #endif // BASE_TEST_TEST_REG_UTIL_WIN_H_ |
| OLD | NEW |