Skip to content

Commit

Permalink
Clean up unused param in RegistryOverrideManager
Browse files Browse the repository at this point in the history
This param has been unused since http://crrev.com/234367 and makes the method confusing.

BUG=314800

Review URL: https://codereview.chromium.org/575253002

Cr-Commit-Position: refs/heads/master@{#295400}
  • Loading branch information
gab authored and Commit bot committed Sep 18, 2014
1 parent f193baa commit 6f7c83b
Show file tree
Hide file tree
Showing 19 changed files with 40 additions and 49 deletions.
4 changes: 1 addition & 3 deletions base/test/test_reg_util_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ RegistryOverrideManager::RegistryOverrideManager(

RegistryOverrideManager::~RegistryOverrideManager() {}

void RegistryOverrideManager::OverrideRegistry(
HKEY override,
const base::string16& /*override_name*/) {
void RegistryOverrideManager::OverrideRegistry(HKEY override) {
base::string16 key_path = GenerateTempKeyPath(test_key_root_, timestamp_);
overrides_.push_back(new ScopedRegistryKeyOverride(override, key_path));
}
Expand Down
9 changes: 4 additions & 5 deletions base/test/test_reg_util_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ class RegistryOverrideManager {
RegistryOverrideManager();
~RegistryOverrideManager();

// Override the given registry hive using a temporary key named by temp_name
// under the temporary test key path. There is no need to randomize
// |override_name|, as a random parent key is generated. Multiple overrides to
// the same hive are not supported and lead to undefined behavior.
void OverrideRegistry(HKEY override, const base::string16& override_name);
// Override the given registry hive using a randomly generated temporary key.
// Multiple overrides to the same hive are not supported and lead to undefined
// behavior.
void OverrideRegistry(HKEY override);

private:
friend class RegistryOverrideManagerTest;
Expand Down
2 changes: 1 addition & 1 deletion base/test/test_reg_util_win_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class RegistryOverrideManagerTest : public testing::Test {

void CreateManager(const base::Time& timestamp) {
manager_.reset(new RegistryOverrideManager(timestamp, fake_test_key_root_));
manager_->OverrideRegistry(HKEY_CURRENT_USER, L"override_manager_unittest");
manager_->OverrideRegistry(HKEY_CURRENT_USER);
}

base::string16 fake_test_key_root_;
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/chrome_elf_init_unittest_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ class ChromeBlacklistTrialTest : public testing::Test {
virtual void SetUp() OVERRIDE {
testing::Test::SetUp();

override_manager_.OverrideRegistry(HKEY_CURRENT_USER,
L"browser_blacklist_test");
override_manager_.OverrideRegistry(HKEY_CURRENT_USER);

blacklist_registry_key_.reset(
new base::win::RegKey(HKEY_CURRENT_USER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void ScopedTestNativeMessagingHost::RegisterTestHost(bool user_level) {

#if defined(OS_WIN)
HKEY root_key = user_level ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
registry_override_.OverrideRegistry(root_key, L"native_messaging");
registry_override_.OverrideRegistry(root_key);
#else
path_override_.reset(new base::ScopedPathOverride(
user_level ? chrome::DIR_USER_NATIVE_MESSAGING
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ void EnsureMediaDirectoriesExists::Init() {
local_app_data_override_.reset(new base::ScopedPathOverride(
base::DIR_LOCAL_APP_DATA, GetFakeLocalAppDataPath()));
// Picasa also looks in the registry for an alternate path.
registry_override_.OverrideRegistry(HKEY_CURRENT_USER, L"hkcu_picasa");
registry_override_.OverrideRegistry(HKEY_CURRENT_USER);
#endif // OS_WIN

#if defined(OS_MACOSX)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ TEST(SafeBrowsingEnvironmentDataCollectionWinTest, CollectDllBlacklistData) {
// Ensure that CollectDllBlacklistData correctly adds the set of sanitized dll
// names currently stored in the registry to the report.
registry_util::RegistryOverrideManager override_manager;
override_manager.OverrideRegistry(HKEY_CURRENT_USER, L"safe_browsing_test");
override_manager.OverrideRegistry(HKEY_CURRENT_USER);

base::win::RegKey blacklist_registry_key(HKEY_CURRENT_USER,
blacklist::kRegistryFinchListPath,
Expand Down
4 changes: 1 addition & 3 deletions chrome/installer/gcapi/gcapi_last_run_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ class GCAPILastRunTest : public ::testing::Test {
protected:
void SetUp() {
// Override keys - this is undone during destruction.
std::wstring hkcu_override = base::StringPrintf(
L"hkcu_override\\%ls", base::ASCIIToWide(base::GenerateGUID()).c_str());
override_manager_.OverrideRegistry(HKEY_CURRENT_USER, hkcu_override);
override_manager_.OverrideRegistry(HKEY_CURRENT_USER);

// Create the client state key in the right places.
std::wstring reg_path(google_update::kRegPathClientState);
Expand Down
4 changes: 2 additions & 2 deletions chrome/installer/gcapi/gcapi_test_registry_overrider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

GCAPITestRegistryOverrider::GCAPITestRegistryOverrider() {
// Override keys - this is undone during destruction.
override_manager_.OverrideRegistry(HKEY_CURRENT_USER, L"hkcu_override");
override_manager_.OverrideRegistry(HKEY_LOCAL_MACHINE, L"hklm_override");
override_manager_.OverrideRegistry(HKEY_CURRENT_USER);
override_manager_.OverrideRegistry(HKEY_LOCAL_MACHINE);
}

GCAPITestRegistryOverrider::~GCAPITestRegistryOverrider() {
Expand Down
3 changes: 1 addition & 2 deletions chrome/installer/setup/setup_util_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,7 @@ namespace {
class MigrateMultiToSingleTest : public testing::Test {
protected:
virtual void SetUp() OVERRIDE {
registry_override_manager_.OverrideRegistry(kRootKey,
L"MigrateMultiToSingleTest");
registry_override_manager_.OverrideRegistry(kRootKey);
}

static const bool kSystemLevel = false;
Expand Down
6 changes: 3 additions & 3 deletions chrome/installer/util/google_update_settings_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ const wchar_t kTestExperimentLabel[] = L"test_label_value";
class GoogleUpdateSettingsTest : public testing::Test {
protected:
virtual void SetUp() OVERRIDE {
registry_overrides_.OverrideRegistry(HKEY_LOCAL_MACHINE, L"HKLM_pit");
registry_overrides_.OverrideRegistry(HKEY_CURRENT_USER, L"HKCU_pit");
registry_overrides_.OverrideRegistry(HKEY_LOCAL_MACHINE);
registry_overrides_.OverrideRegistry(HKEY_CURRENT_USER);
}

enum SystemUserInstall {
Expand Down Expand Up @@ -1084,7 +1084,7 @@ void CollectStatsConsent::SetUp() {
base::string16 reg_temp_name(
stats_state.system_level() ? L"HKLM_" : L"HKCU_");
reg_temp_name += L"CollectStatsConsent";
override_manager_.OverrideRegistry(root_key, reg_temp_name);
override_manager_.OverrideRegistry(root_key);

if (stats_state.multi_install()) {
MakeChromeMultiInstall(root_key);
Expand Down
20 changes: 10 additions & 10 deletions chrome/installer/util/install_util_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ TEST_F(InstallUtilTest, UpdateInstallerStageAP) {
// Update the stage when there's no "ap" value.
{
RegistryOverrideManager override_manager;
override_manager.OverrideRegistry(root, L"root_inst_res");
override_manager.OverrideRegistry(root);
RegKey(root, state_key_path.c_str(), KEY_SET_VALUE);
InstallUtil::UpdateInstallerStage(system_level, state_key_path,
installer::BUILDING);
Expand All @@ -96,7 +96,7 @@ TEST_F(InstallUtilTest, UpdateInstallerStageAP) {
// Update the stage when there is an "ap" value.
{
RegistryOverrideManager override_manager;
override_manager.OverrideRegistry(root, L"root_inst_res");
override_manager.OverrideRegistry(root);
RegKey(root, state_key_path.c_str(), KEY_SET_VALUE)
.WriteValue(google_update::kRegApField, L"2.0-dev");
InstallUtil::UpdateInstallerStage(system_level, state_key_path,
Expand All @@ -111,7 +111,7 @@ TEST_F(InstallUtilTest, UpdateInstallerStageAP) {
// Clear the stage.
{
RegistryOverrideManager override_manager;
override_manager.OverrideRegistry(root, L"root_inst_res");
override_manager.OverrideRegistry(root);
RegKey(root, state_key_path.c_str(), KEY_SET_VALUE)
.WriteValue(google_update::kRegApField, L"2.0-dev-stage:building");
InstallUtil::UpdateInstallerStage(system_level, state_key_path,
Expand All @@ -132,7 +132,7 @@ TEST_F(InstallUtilTest, UpdateInstallerStage) {
// Update the stage when there's no "InstallerExtraCode1" value.
{
RegistryOverrideManager override_manager;
override_manager.OverrideRegistry(root, L"root_inst_res");
override_manager.OverrideRegistry(root);
RegKey(root, state_key_path.c_str(), KEY_SET_VALUE)
.DeleteValue(installer::kInstallerExtraCode1);
InstallUtil::UpdateInstallerStage(system_level, state_key_path,
Expand All @@ -147,7 +147,7 @@ TEST_F(InstallUtilTest, UpdateInstallerStage) {
// Update the stage when there is an "InstallerExtraCode1" value.
{
RegistryOverrideManager override_manager;
override_manager.OverrideRegistry(root, L"root_inst_res");
override_manager.OverrideRegistry(root);
RegKey(root, state_key_path.c_str(), KEY_SET_VALUE)
.WriteValue(installer::kInstallerExtraCode1,
static_cast<DWORD>(installer::UNPACKING));
Expand All @@ -163,7 +163,7 @@ TEST_F(InstallUtilTest, UpdateInstallerStage) {
// Clear the stage.
{
RegistryOverrideManager override_manager;
override_manager.OverrideRegistry(root, L"root_inst_res");
override_manager.OverrideRegistry(root);
RegKey(root, state_key_path.c_str(), KEY_SET_VALUE)
.WriteValue(installer::kInstallerExtraCode1, static_cast<DWORD>(5));
InstallUtil::UpdateInstallerStage(system_level, state_key_path,
Expand All @@ -185,7 +185,7 @@ TEST_F(InstallUtilTest, DeleteRegistryKeyIf) {

{
RegistryOverrideManager override_manager;
override_manager.OverrideRegistry(root, L"root_key");
override_manager.OverrideRegistry(root);
// Nothing to delete if the keys aren't even there.
{
MockRegistryValuePredicate pred;
Expand Down Expand Up @@ -293,7 +293,7 @@ TEST_F(InstallUtilTest, DeleteRegistryValueIf) {

{
RegistryOverrideManager override_manager;
override_manager.OverrideRegistry(root, L"root_key");
override_manager.OverrideRegistry(root);
// Nothing to delete if the key isn't even there.
{
MockRegistryValuePredicate pred;
Expand Down Expand Up @@ -357,7 +357,7 @@ TEST_F(InstallUtilTest, DeleteRegistryValueIf) {

{
RegistryOverrideManager override_manager;
override_manager.OverrideRegistry(root, L"root_key");
override_manager.OverrideRegistry(root);
// Default value matches: delete using empty string.
{
MockRegistryValuePredicate pred;
Expand All @@ -378,7 +378,7 @@ TEST_F(InstallUtilTest, DeleteRegistryValueIf) {

{
RegistryOverrideManager override_manager;
override_manager.OverrideRegistry(root, L"root_key");
override_manager.OverrideRegistry(root);
// Default value matches: delete using NULL.
{
MockRegistryValuePredicate pred;
Expand Down
10 changes: 5 additions & 5 deletions chrome/installer/util/installer_state_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ TEST_F(InstallerStateTest, WithProduct) {

{
RegistryOverrideManager override_manager;
override_manager.OverrideRegistry(root, L"root_pit");
override_manager.OverrideRegistry(root);
BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution(
BrowserDistribution::CHROME_BROWSER);
RegKey chrome_key(root, dist->GetVersionKey().c_str(), KEY_ALL_ACCESS);
Expand Down Expand Up @@ -385,7 +385,7 @@ TEST_F(InstallerStateTest, InstallerResult) {
// check results for a fresh install of single Chrome
{
RegistryOverrideManager override_manager;
override_manager.OverrideRegistry(root, L"root_inst_res");
override_manager.OverrideRegistry(root);
CommandLine cmd_line = CommandLine::FromString(L"setup.exe --system-level");
const MasterPreferences prefs(cmd_line);
InstallationState machine_state;
Expand Down Expand Up @@ -416,7 +416,7 @@ TEST_F(InstallerStateTest, InstallerResult) {
// check results for a fresh install of multi Chrome
{
RegistryOverrideManager override_manager;
override_manager.OverrideRegistry(root, L"root_inst_res");
override_manager.OverrideRegistry(root);
CommandLine cmd_line = CommandLine::FromString(
L"setup.exe --system-level --multi-install --chrome");
const MasterPreferences prefs(cmd_line);
Expand Down Expand Up @@ -617,8 +617,8 @@ TEST_F(InstallerStateTest, InitializeTwice) {
base::ScopedPathOverride local_app_data_override(base::DIR_LOCAL_APP_DATA,
temp);
registry_util::RegistryOverrideManager override_manager;
override_manager.OverrideRegistry(HKEY_CURRENT_USER, base::string16());
override_manager.OverrideRegistry(HKEY_LOCAL_MACHINE, base::string16());
override_manager.OverrideRegistry(HKEY_CURRENT_USER);
override_manager.OverrideRegistry(HKEY_LOCAL_MACHINE);

InstallationState machine_state;
machine_state.Initialize();
Expand Down
2 changes: 1 addition & 1 deletion chrome/installer/util/product_state_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void ProductStateTest::SetUp() {
// directly because it doesn't suit itself to our use here.
RegKey temp_key;

registry_override_manager_.OverrideRegistry(overridden_, L"ProductStateTest");
registry_override_manager_.OverrideRegistry(overridden_);

EXPECT_EQ(ERROR_SUCCESS,
clients_.Create(overridden_, dist_->GetVersionKey().c_str(),
Expand Down
2 changes: 1 addition & 1 deletion chrome/installer/util/product_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ TEST_F(ProductTest, ProductInstallBasic) {
HKEY root = installer_state.root_key();
{
RegistryOverrideManager override_manager;
override_manager.OverrideRegistry(root, L"root_pit");
override_manager.OverrideRegistry(root);

// There should be no installed version in the registry.
machine_state.Initialize();
Expand Down
2 changes: 1 addition & 1 deletion chrome/installer/util/work_item_list_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class WorkItemListTest : public testing::Test {
protected:
virtual void SetUp() {
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
registry_override_manager_.OverrideRegistry(HKEY_CURRENT_USER, L"root_pit");
registry_override_manager_.OverrideRegistry(HKEY_CURRENT_USER);
}

virtual void TearDown() {
Expand Down
2 changes: 1 addition & 1 deletion chrome_elf/blacklist/test/blacklist_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace {
class BlacklistTest : public testing::Test {
protected:
BlacklistTest() : override_manager_() {
override_manager_.OverrideRegistry(HKEY_CURRENT_USER, L"beacon_test");
override_manager_.OverrideRegistry(HKEY_CURRENT_USER);
}

scoped_ptr<base::win::RegKey> blacklist_registry_key_;
Expand Down
6 changes: 2 additions & 4 deletions chrome_elf/chrome_elf_util_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,8 @@ class ChromeElfUtilTest :
const char*> > {
protected:
virtual void SetUp() OVERRIDE {
override_manager_.OverrideRegistry(HKEY_LOCAL_MACHINE,
L"chrome_elf_test_local");
override_manager_.OverrideRegistry(HKEY_CURRENT_USER,
L"chrome_elf_test_current");
override_manager_.OverrideRegistry(HKEY_LOCAL_MACHINE);
override_manager_.OverrideRegistry(HKEY_CURRENT_USER);
const char* app;
const char* level;
const char* mode;
Expand Down
4 changes: 2 additions & 2 deletions rlz/test/rlz_test_helpers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ void InitializeRegistryOverridesForTesting(
KEY_READ), &data);
}

override_manager->OverrideRegistry(HKEY_LOCAL_MACHINE, L"rlz_temp_hklm");
override_manager->OverrideRegistry(HKEY_CURRENT_USER, L"rlz_temp_hkcu");
override_manager->OverrideRegistry(HKEY_LOCAL_MACHINE);
override_manager->OverrideRegistry(HKEY_CURRENT_USER);

if (do_copy) {
base::win::RegKey key(
Expand Down

0 comments on commit 6f7c83b

Please sign in to comment.