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

Unified Diff: trunk/src/chrome/installer/util/product_state_unittest.cc

Issue 69793004: Revert 234367 "Base: Make RegistryOverrideManager support sharde..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 1 month 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
Index: trunk/src/chrome/installer/util/product_state_unittest.cc
===================================================================
--- trunk/src/chrome/installer/util/product_state_unittest.cc (revision 234626)
+++ trunk/src/chrome/installer/util/product_state_unittest.cc (working copy)
@@ -31,14 +31,15 @@
void MinimallyInstallProduct(const wchar_t* version);
static BrowserDistribution* dist_;
+ static std::wstring temp_key_path_;
bool system_install_;
HKEY overridden_;
- registry_util::RegistryOverrideManager registry_override_manager_;
RegKey clients_;
RegKey client_state_;
};
BrowserDistribution* ProductStateTest::dist_;
+std::wstring ProductStateTest::temp_key_path_;
// static
void ProductStateTest::SetUpTestCase() {
@@ -47,10 +48,16 @@
// We'll use Chrome as our test subject.
dist_ = BrowserDistribution::GetSpecificDistribution(
BrowserDistribution::CHROME_BROWSER);
+
+ // And we'll play in HKCU here:
+ temp_key_path_.assign(RegistryOverrideManager::kTempTestKeyPath)
+ .append(1, L'\\')
+ .append(L"ProductStateTest");
}
// static
void ProductStateTest::TearDownTestCase() {
+ temp_key_path_.clear();
dist_ = NULL;
testing::Test::TearDownTestCase();
@@ -66,9 +73,12 @@
// Override for test purposes. We don't use ScopedRegistryKeyOverride
// directly because it doesn't suit itself to our use here.
RegKey temp_key;
+ EXPECT_EQ(ERROR_SUCCESS,
+ temp_key.Create(HKEY_CURRENT_USER, temp_key_path_.c_str(),
+ KEY_ALL_ACCESS));
+ EXPECT_EQ(ERROR_SUCCESS,
+ ::RegOverridePredefKey(overridden_, temp_key.Handle()));
- registry_override_manager_.OverrideRegistry(overridden_, L"ProductStateTest");
-
EXPECT_EQ(ERROR_SUCCESS,
clients_.Create(overridden_, dist_->GetVersionKey().c_str(),
KEY_ALL_ACCESS));
@@ -81,9 +91,13 @@
// Done with the keys.
client_state_.Close();
clients_.Close();
+ EXPECT_EQ(ERROR_SUCCESS, ::RegOverridePredefKey(overridden_, NULL));
overridden_ = NULL;
system_install_ = false;
+ // Shotgun approach to clearing out data we may have written.
+ RegistryOverrideManager::DeleteAllTempKeys();
+
testing::Test::TearDown();
}
« no previous file with comments | « trunk/src/chrome/installer/setup/setup_util_unittest.cc ('k') | trunk/src/chrome_frame/test/chrome_frame_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698