| 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 <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "base/win/registry.h" | 15 #include "base/win/registry.h" |
| 16 | 16 |
| 17 namespace registry_util { | 17 namespace registry_util { |
| 18 | 18 |
| 19 // Allows a test to easily override registry hives so that it can start from a | 19 // Allows a test to easily override registry hives so that it can start from a |
| 20 // known good state, or make sure to not leave any side effects once the test | 20 // known good state, or make sure to not leave any side effects once the test |
| 21 // completes. This supports parallel tests. All the overrides are scoped to the | 21 // completes. This supports parallel tests. All the overrides are scoped to the |
| 22 // lifetime of the override manager. Destroy the manager to undo the overrides. | 22 // lifetime of the override manager. Destroy the manager to undo the overrides. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 // Used for testing only. | 59 // Used for testing only. |
| 60 RegistryOverrideManager(const base::Time& timestamp, | 60 RegistryOverrideManager(const base::Time& timestamp, |
| 61 const base::string16& test_key_root); | 61 const base::string16& test_key_root); |
| 62 | 62 |
| 63 base::Time timestamp_; | 63 base::Time timestamp_; |
| 64 base::string16 guid_; | 64 base::string16 guid_; |
| 65 | 65 |
| 66 base::string16 test_key_root_; | 66 base::string16 test_key_root_; |
| 67 std::vector<scoped_ptr<ScopedRegistryKeyOverride>> overrides_; | 67 std::vector<std::unique_ptr<ScopedRegistryKeyOverride>> overrides_; |
| 68 | 68 |
| 69 DISALLOW_COPY_AND_ASSIGN(RegistryOverrideManager); | 69 DISALLOW_COPY_AND_ASSIGN(RegistryOverrideManager); |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 // Generates a temporary key path that will be eventually deleted | 72 // Generates a temporary key path that will be eventually deleted |
| 73 // automatically if the process crashes. | 73 // automatically if the process crashes. |
| 74 base::string16 GenerateTempKeyPath(); | 74 base::string16 GenerateTempKeyPath(); |
| 75 | 75 |
| 76 } // namespace registry_util | 76 } // namespace registry_util |
| 77 | 77 |
| 78 #endif // BASE_TEST_TEST_REG_UTIL_WIN_H_ | 78 #endif // BASE_TEST_TEST_REG_UTIL_WIN_H_ |
| OLD | NEW |