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

Unified Diff: chrome/installer/util/registry_test_data.h

Issue 7890069: Added CopyRegKeyWorkItem in support of IE low rights policy fixes. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: sync'd to ToT again Created 9 years, 3 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 | « chrome/installer/util/registry_key_backup_unittest.cc ('k') | chrome/installer/util/registry_test_data.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/registry_test_data.h
diff --git a/chrome/installer/util/registry_test_data.h b/chrome/installer/util/registry_test_data.h
new file mode 100644
index 0000000000000000000000000000000000000000..cd5e0c4b37038e29aad1668525b6d5f69fd028f5
--- /dev/null
+++ b/chrome/installer/util/registry_test_data.h
@@ -0,0 +1,59 @@
+// 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 CHROME_INSTALLER_UTIL_REGISTRY_TEST_DATA_H_
+#define CHROME_INSTALLER_UTIL_REGISTRY_TEST_DATA_H_
+#pragma once
+
+#include <windows.h>
+
+#include <string>
+
+#include "base/basictypes.h"
+
+// A helper class for use by unit tests that need some registry space and data.
+// BEWARE: Instances of this class irrevocably and recursively delete keys and
+// values from the registry. Carefully read the comments for Initialize and
+// Reset before use.
+class RegistryTestData {
+ public:
+ RegistryTestData();
+ // Invokes Reset() on its way out.
+ ~RegistryTestData();
+
+ // Resets this instance, deletes the key rooted at |base_path|, and then
+ // populates |base_path| with:
+ // \EmptyKey
+ // \NonEmptyKey (default value = "|base_path|\NonEmptyKey")
+ // \NonEmptyKey\Subkey ("SomeValue" = DWORD 1)
+ bool Initialize(HKEY root_key, const wchar_t* base_path);
+
+ // Deletes the key rooted at base_path and clears all state.
+ void Reset();
+
+ // Fires Google Test expectations in the hopes that |path| contains the same
+ // data as originally placed in |non_empty_key| by Initialize().
+ void ExpectMatchesNonEmptyKey(HKEY root_key, const wchar_t* path);
+
+ HKEY root_key() const { return root_key_; }
+ const std::wstring& base_path() const { return base_path_; }
+ const std::wstring& empty_key_path() const { return empty_key_path_; }
+ const std::wstring& non_empty_key_path() const { return non_empty_key_path_; }
+
+ // Fires Google Test expectations in the hopes that |path| is an empty key
+ // (exists but has no values or subkeys).
+ static void ExpectEmptyKey(HKEY root_key, const wchar_t* path);
+
+ private:
+ static bool DeleteKey(HKEY root_key, const wchar_t* path);
+
+ HKEY root_key_;
+ std::wstring base_path_;
+ std::wstring empty_key_path_;
+ std::wstring non_empty_key_path_;
+
+ DISALLOW_COPY_AND_ASSIGN(RegistryTestData);
+};
+
+#endif // CHROME_INSTALLER_UTIL_REGISTRY_TEST_DATA_H_
« no previous file with comments | « chrome/installer/util/registry_key_backup_unittest.cc ('k') | chrome/installer/util/registry_test_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698