Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: base/test/test_reg_util_win.h

Issue 7669061: Tommi: I need an owner review for the chrome frame changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fixing license issue from presubmit check Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/base.gyp ('k') | base/test/test_reg_util_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef BASE_TEST_TEST_REG_UTIL_H_
6 #define BASE_TEST_TEST_REG_UTIL_H_
7 #pragma once
8
9 // Registry utility functions used only by tests.
10
11 #include <string>
12 #include <vector>
13
14 #include "base/basictypes.h"
15 #include "base/win/registry.h"
16
17 namespace registry_util {
18
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
21 // completes.
22 class RegistryOverrideManager {
23 public:
24 // All overridden hives will be descendents of this registry path under the
25 // main HKCU hive.
26 static const wchar_t kTempTestKeyPath[];
27
28 RegistryOverrideManager();
29 ~RegistryOverrideManager();
30
31 // Override the given registry hive using a temporary key named by temp_name
32 // under the temporary test key path.
33 void OverrideRegistry(HKEY override, const std::wstring& temp_name);
34
35 // Deletes all temporary test keys used by the overrides.
36 static void DeleteAllTempKeys();
37
38 // Removes all overrides and deletes all temporary test keys used by the
39 // overrides.
40 void RemoveAllOverrides();
41
42 private:
43 // Keeps track of one override.
44 class ScopedRegistryKeyOverride {
45 public:
46 ScopedRegistryKeyOverride(HKEY override, const std::wstring& temp_name);
47 ~ScopedRegistryKeyOverride();
48
49 private:
50 HKEY override_;
51 base::win::RegKey temp_key_;
52 std::wstring temp_name_;
53
54 DISALLOW_COPY_AND_ASSIGN(ScopedRegistryKeyOverride);
55 };
56
57 std::vector<ScopedRegistryKeyOverride*> overrides_;
58
59 DISALLOW_COPY_AND_ASSIGN(RegistryOverrideManager);
60 };
61
62 } // namespace registry_util
63
64 #endif // BASE_TEST_TEST_REG_UTIL_H_
OLDNEW
« no previous file with comments | « base/base.gyp ('k') | base/test/test_reg_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698