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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/base.gyp ('k') | base/test/test_reg_util_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/test_reg_util_win.h
===================================================================
--- base/test/test_reg_util_win.h (revision 0)
+++ base/test/test_reg_util_win.h (revision 0)
@@ -0,0 +1,64 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_TEST_TEST_REG_UTIL_H_
+#define BASE_TEST_TEST_REG_UTIL_H_
+#pragma once
+
+// Registry utility functions used only by tests.
+
+#include <string>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/win/registry.h"
+
+namespace registry_util {
+
+// Allows a test to easily override registry hives so that it can start from a
+// known good state, or make sure to not leave any side effects once the test
+// completes.
+class RegistryOverrideManager {
+ public:
+ // All overridden hives will be descendents of this registry path under the
+ // main HKCU hive.
+ static const wchar_t kTempTestKeyPath[];
+
+ RegistryOverrideManager();
+ ~RegistryOverrideManager();
+
+ // Override the given registry hive using a temporary key named by temp_name
+ // under the temporary test key path.
+ void OverrideRegistry(HKEY override, const std::wstring& temp_name);
+
+ // Deletes all temporary test keys used by the overrides.
+ static void DeleteAllTempKeys();
+
+ // Removes all overrides and deletes all temporary test keys used by the
+ // overrides.
+ void RemoveAllOverrides();
+
+ private:
+ // Keeps track of one override.
+ class ScopedRegistryKeyOverride {
+ public:
+ ScopedRegistryKeyOverride(HKEY override, const std::wstring& temp_name);
+ ~ScopedRegistryKeyOverride();
+
+ private:
+ HKEY override_;
+ base::win::RegKey temp_key_;
+ std::wstring temp_name_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedRegistryKeyOverride);
+ };
+
+ std::vector<ScopedRegistryKeyOverride*> overrides_;
+
+ DISALLOW_COPY_AND_ASSIGN(RegistryOverrideManager);
+};
+
+} // namespace registry_util
+
+#endif // BASE_TEST_TEST_REG_UTIL_H_
Property changes on: base\test\test_reg_util_win.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« 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