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

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: Force registry overrides to go through new override manager 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 // Keeps track of one override.
Paweł Hajdan Jr. 2011/08/23 18:19:05 nit: How about just moving this down to the privat
Roger Tawa OOO till Jul 10th 2011/08/23 18:33:48 Done.
24 class ScopedRegistryKeyOverride {
25 public:
26 ScopedRegistryKeyOverride(HKEY override, const std::wstring& temp_name);
27 ~ScopedRegistryKeyOverride();
28
29 private:
30 HKEY override_;
31 base::win::RegKey temp_key_;
32 std::wstring temp_name_;
33
34 DISALLOW_COPY_AND_ASSIGN(ScopedRegistryKeyOverride);
35 };
36
37 public:
38 // All overridden hives will be descendents of this registry path under the
39 // main HKCU hive.
40 static const wchar_t kTempTestKeyPath[];
41
42 RegistryOverrideManager();
43 ~RegistryOverrideManager();
44
45 // Override the given registry hive using a temporary key named by temp_name
46 // under the temporary test key path.
47 void OverrideRegistry(HKEY override, const std::wstring& temp_name);
48
49 // Deletes all temporary test keys used by the overrides.
50 static void DeleteAllTempKeys();
51
52 // Removes all overrides and deletes all temporary test keys used by the
53 // overrides.
54 void RemoveAllOverrides();
55
56 private:
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