| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/installer/util/google_update_settings.h" | 5 #include "chrome/installer/util/google_update_settings.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shlwapi.h> // For SHDeleteKey. | 8 #include <shlwapi.h> // For SHDeleteKey. |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 const wchar_t kTestProductGuid[] = L"{89F1B351-B15D-48D4-8F10-1298721CF13D}"; | 29 const wchar_t kTestProductGuid[] = L"{89F1B351-B15D-48D4-8F10-1298721CF13D}"; |
| 30 const wchar_t kTestExperimentLabel[] = L"test_label_value"; | 30 const wchar_t kTestExperimentLabel[] = L"test_label_value"; |
| 31 | 31 |
| 32 // This test fixture redirects the HKLM and HKCU registry hives for | 32 // This test fixture redirects the HKLM and HKCU registry hives for |
| 33 // the duration of the test to make it independent of the machine | 33 // the duration of the test to make it independent of the machine |
| 34 // and user settings. | 34 // and user settings. |
| 35 class GoogleUpdateSettingsTest : public testing::Test { | 35 class GoogleUpdateSettingsTest : public testing::Test { |
| 36 protected: | 36 protected: |
| 37 virtual void SetUp() OVERRIDE { | 37 virtual void SetUp() OVERRIDE { |
| 38 registry_overrides_.OverrideRegistry(HKEY_LOCAL_MACHINE, L"HKLM_pit"); | 38 registry_overrides_.OverrideRegistry(HKEY_LOCAL_MACHINE); |
| 39 registry_overrides_.OverrideRegistry(HKEY_CURRENT_USER, L"HKCU_pit"); | 39 registry_overrides_.OverrideRegistry(HKEY_CURRENT_USER); |
| 40 } | 40 } |
| 41 | 41 |
| 42 enum SystemUserInstall { | 42 enum SystemUserInstall { |
| 43 SYSTEM_INSTALL, | 43 SYSTEM_INSTALL, |
| 44 USER_INSTALL, | 44 USER_INSTALL, |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 void SetApField(SystemUserInstall is_system, const wchar_t* value) { | 47 void SetApField(SystemUserInstall is_system, const wchar_t* value) { |
| 48 HKEY root = is_system == SYSTEM_INSTALL ? | 48 HKEY root = is_system == SYSTEM_INSTALL ? |
| 49 HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; | 49 HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; |
| (...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 delete binaries_state_medium_key_; | 1077 delete binaries_state_medium_key_; |
| 1078 } | 1078 } |
| 1079 | 1079 |
| 1080 // Install the registry override and apply the settings to the registry. | 1080 // Install the registry override and apply the settings to the registry. |
| 1081 void CollectStatsConsent::SetUp() { | 1081 void CollectStatsConsent::SetUp() { |
| 1082 const StatsState& stats_state = GetParam(); | 1082 const StatsState& stats_state = GetParam(); |
| 1083 const HKEY root_key = stats_state.root_key(); | 1083 const HKEY root_key = stats_state.root_key(); |
| 1084 base::string16 reg_temp_name( | 1084 base::string16 reg_temp_name( |
| 1085 stats_state.system_level() ? L"HKLM_" : L"HKCU_"); | 1085 stats_state.system_level() ? L"HKLM_" : L"HKCU_"); |
| 1086 reg_temp_name += L"CollectStatsConsent"; | 1086 reg_temp_name += L"CollectStatsConsent"; |
| 1087 override_manager_.OverrideRegistry(root_key, reg_temp_name); | 1087 override_manager_.OverrideRegistry(root_key); |
| 1088 | 1088 |
| 1089 if (stats_state.multi_install()) { | 1089 if (stats_state.multi_install()) { |
| 1090 MakeChromeMultiInstall(root_key); | 1090 MakeChromeMultiInstall(root_key); |
| 1091 ApplySetting(stats_state.state_value(), root_key, *binaries_state_key_); | 1091 ApplySetting(stats_state.state_value(), root_key, *binaries_state_key_); |
| 1092 ApplySetting(stats_state.state_medium_value(), root_key, | 1092 ApplySetting(stats_state.state_medium_value(), root_key, |
| 1093 *binaries_state_medium_key_); | 1093 *binaries_state_medium_key_); |
| 1094 } else { | 1094 } else { |
| 1095 ApplySetting(stats_state.state_value(), root_key, *chrome_state_key_); | 1095 ApplySetting(stats_state.state_value(), root_key, *chrome_state_key_); |
| 1096 ApplySetting(stats_state.state_medium_value(), root_key, | 1096 ApplySetting(stats_state.state_medium_value(), root_key, |
| 1097 *chrome_state_medium_key_); | 1097 *chrome_state_medium_key_); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 StatsState(StatsState::kSystemLevel, StatsState::MULTI_INSTALL, | 1227 StatsState(StatsState::kSystemLevel, StatsState::MULTI_INSTALL, |
| 1228 StatsState::FALSE_SETTING, StatsState::FALSE_SETTING), | 1228 StatsState::FALSE_SETTING, StatsState::FALSE_SETTING), |
| 1229 StatsState(StatsState::kSystemLevel, StatsState::MULTI_INSTALL, | 1229 StatsState(StatsState::kSystemLevel, StatsState::MULTI_INSTALL, |
| 1230 StatsState::FALSE_SETTING, StatsState::TRUE_SETTING), | 1230 StatsState::FALSE_SETTING, StatsState::TRUE_SETTING), |
| 1231 StatsState(StatsState::kSystemLevel, StatsState::MULTI_INSTALL, | 1231 StatsState(StatsState::kSystemLevel, StatsState::MULTI_INSTALL, |
| 1232 StatsState::TRUE_SETTING, StatsState::NO_SETTING), | 1232 StatsState::TRUE_SETTING, StatsState::NO_SETTING), |
| 1233 StatsState(StatsState::kSystemLevel, StatsState::MULTI_INSTALL, | 1233 StatsState(StatsState::kSystemLevel, StatsState::MULTI_INSTALL, |
| 1234 StatsState::TRUE_SETTING, StatsState::FALSE_SETTING), | 1234 StatsState::TRUE_SETTING, StatsState::FALSE_SETTING), |
| 1235 StatsState(StatsState::kSystemLevel, StatsState::MULTI_INSTALL, | 1235 StatsState(StatsState::kSystemLevel, StatsState::MULTI_INSTALL, |
| 1236 StatsState::TRUE_SETTING, StatsState::TRUE_SETTING))); | 1236 StatsState::TRUE_SETTING, StatsState::TRUE_SETTING))); |
| OLD | NEW |