| 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 16 matching lines...) Expand all Loading... |
| 27 namespace { | 27 namespace { |
| 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); | 38 registry_overrides_.OverrideRegistry(HKEY_LOCAL_MACHINE); |
| 39 registry_overrides_.OverrideRegistry(HKEY_CURRENT_USER); | 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) { |
| (...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 | 851 |
| 852 #endif // defined(GOOGLE_CHROME_BUILD) | 852 #endif // defined(GOOGLE_CHROME_BUILD) |
| 853 | 853 |
| 854 // Test GoogleUpdateSettings::GetUninstallCommandLine at system- or user-level, | 854 // Test GoogleUpdateSettings::GetUninstallCommandLine at system- or user-level, |
| 855 // according to the param. | 855 // according to the param. |
| 856 class GetUninstallCommandLine : public GoogleUpdateSettingsTest, | 856 class GetUninstallCommandLine : public GoogleUpdateSettingsTest, |
| 857 public testing::WithParamInterface<bool> { | 857 public testing::WithParamInterface<bool> { |
| 858 protected: | 858 protected: |
| 859 static const wchar_t kDummyCommand[]; | 859 static const wchar_t kDummyCommand[]; |
| 860 | 860 |
| 861 virtual void SetUp() OVERRIDE { | 861 virtual void SetUp() override { |
| 862 GoogleUpdateSettingsTest::SetUp(); | 862 GoogleUpdateSettingsTest::SetUp(); |
| 863 system_install_ = GetParam(); | 863 system_install_ = GetParam(); |
| 864 root_key_ = system_install_ ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; | 864 root_key_ = system_install_ ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; |
| 865 } | 865 } |
| 866 | 866 |
| 867 HKEY root_key_; | 867 HKEY root_key_; |
| 868 bool system_install_; | 868 bool system_install_; |
| 869 }; | 869 }; |
| 870 | 870 |
| 871 const wchar_t GetUninstallCommandLine::kDummyCommand[] = | 871 const wchar_t GetUninstallCommandLine::kDummyCommand[] = |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 INSTANTIATE_TEST_CASE_P(GetUninstallCommandLineAtLevel, GetUninstallCommandLine, | 910 INSTANTIATE_TEST_CASE_P(GetUninstallCommandLineAtLevel, GetUninstallCommandLine, |
| 911 testing::Bool()); | 911 testing::Bool()); |
| 912 | 912 |
| 913 // Test GoogleUpdateSettings::GetGoogleUpdateVersion at system- or user-level, | 913 // Test GoogleUpdateSettings::GetGoogleUpdateVersion at system- or user-level, |
| 914 // according to the param. | 914 // according to the param. |
| 915 class GetGoogleUpdateVersion : public GoogleUpdateSettingsTest, | 915 class GetGoogleUpdateVersion : public GoogleUpdateSettingsTest, |
| 916 public testing::WithParamInterface<bool> { | 916 public testing::WithParamInterface<bool> { |
| 917 protected: | 917 protected: |
| 918 static const wchar_t kDummyVersion[]; | 918 static const wchar_t kDummyVersion[]; |
| 919 | 919 |
| 920 virtual void SetUp() OVERRIDE { | 920 virtual void SetUp() override { |
| 921 GoogleUpdateSettingsTest::SetUp(); | 921 GoogleUpdateSettingsTest::SetUp(); |
| 922 system_install_ = GetParam(); | 922 system_install_ = GetParam(); |
| 923 root_key_ = system_install_ ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; | 923 root_key_ = system_install_ ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; |
| 924 } | 924 } |
| 925 | 925 |
| 926 HKEY root_key_; | 926 HKEY root_key_; |
| 927 bool system_install_; | 927 bool system_install_; |
| 928 }; | 928 }; |
| 929 | 929 |
| 930 const wchar_t GetGoogleUpdateVersion::kDummyVersion[] = L"1.2.3.4"; | 930 const wchar_t GetGoogleUpdateVersion::kDummyVersion[] = L"1.2.3.4"; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 | 1028 |
| 1029 const StatsState::UserLevelState StatsState::kUserLevel = {}; | 1029 const StatsState::UserLevelState StatsState::kUserLevel = {}; |
| 1030 const StatsState::SystemLevelState StatsState::kSystemLevel = {}; | 1030 const StatsState::SystemLevelState StatsState::kSystemLevel = {}; |
| 1031 | 1031 |
| 1032 // A value parameterized test for testing the stats collection consent setting. | 1032 // A value parameterized test for testing the stats collection consent setting. |
| 1033 class CollectStatsConsent : public ::testing::TestWithParam<StatsState> { | 1033 class CollectStatsConsent : public ::testing::TestWithParam<StatsState> { |
| 1034 public: | 1034 public: |
| 1035 static void SetUpTestCase(); | 1035 static void SetUpTestCase(); |
| 1036 static void TearDownTestCase(); | 1036 static void TearDownTestCase(); |
| 1037 protected: | 1037 protected: |
| 1038 virtual void SetUp() OVERRIDE; | 1038 virtual void SetUp() override; |
| 1039 static void MakeChromeMultiInstall(HKEY root_key); | 1039 static void MakeChromeMultiInstall(HKEY root_key); |
| 1040 static void ApplySetting(StatsState::StateSetting setting, | 1040 static void ApplySetting(StatsState::StateSetting setting, |
| 1041 HKEY root_key, | 1041 HKEY root_key, |
| 1042 const base::string16& reg_key); | 1042 const base::string16& reg_key); |
| 1043 | 1043 |
| 1044 static base::string16* chrome_version_key_; | 1044 static base::string16* chrome_version_key_; |
| 1045 static base::string16* chrome_state_key_; | 1045 static base::string16* chrome_state_key_; |
| 1046 static base::string16* chrome_state_medium_key_; | 1046 static base::string16* chrome_state_medium_key_; |
| 1047 static base::string16* binaries_state_key_; | 1047 static base::string16* binaries_state_key_; |
| 1048 static base::string16* binaries_state_medium_key_; | 1048 static base::string16* binaries_state_medium_key_; |
| (...skipping 178 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 |