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 <vector> |
9 | 10 |
10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
11 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
14 #include "base/win/registry.h" | 15 #include "base/win/registry.h" |
15 | 16 |
16 namespace registry_util { | 17 namespace registry_util { |
17 | 18 |
18 // 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 |
19 // 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 |
20 // 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 |
21 // 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... |
56 }; | 57 }; |
57 | 58 |
58 // Used for testing only. | 59 // Used for testing only. |
59 RegistryOverrideManager(const base::Time& timestamp, | 60 RegistryOverrideManager(const base::Time& timestamp, |
60 const base::string16& test_key_root); | 61 const base::string16& test_key_root); |
61 | 62 |
62 base::Time timestamp_; | 63 base::Time timestamp_; |
63 base::string16 guid_; | 64 base::string16 guid_; |
64 | 65 |
65 base::string16 test_key_root_; | 66 base::string16 test_key_root_; |
66 ScopedVector<ScopedRegistryKeyOverride> overrides_; | 67 std::vector<scoped_ptr<ScopedRegistryKeyOverride>> overrides_; |
67 | 68 |
68 DISALLOW_COPY_AND_ASSIGN(RegistryOverrideManager); | 69 DISALLOW_COPY_AND_ASSIGN(RegistryOverrideManager); |
69 }; | 70 }; |
70 | 71 |
71 // Generates a temporary key path that will be eventually deleted | 72 // Generates a temporary key path that will be eventually deleted |
72 // automatically if the process crashes. | 73 // automatically if the process crashes. |
73 base::string16 GenerateTempKeyPath(); | 74 base::string16 GenerateTempKeyPath(); |
74 | 75 |
75 } // namespace registry_util | 76 } // namespace registry_util |
76 | 77 |
77 #endif // BASE_TEST_TEST_REG_UTIL_WIN_H_ | 78 #endif // BASE_TEST_TEST_REG_UTIL_WIN_H_ |
OLD | NEW |