| 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/setup/setup_util_unittest.h" | 5 #include "chrome/installer/setup/setup_util_unittest.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shlobj.h> | 8 #include <shlobj.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
| 15 #include "base/files/scoped_temp_dir.h" | 15 #include "base/files/scoped_temp_dir.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
| 18 #include "base/process/kill.h" | 18 #include "base/process/kill.h" |
| 19 #include "base/process/launch.h" | 19 #include "base/process/launch.h" |
| 20 #include "base/process/process_handle.h" | 20 #include "base/process/process_handle.h" |
| 21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
| 22 #include "base/test/histogram_tester.h" | 22 #include "base/test/histogram_tester.h" |
| 23 #include "base/test/test_reg_util_win.h" | 23 #include "base/test/test_reg_util_win.h" |
| 24 #include "base/test/test_timeouts.h" | 24 #include "base/test/test_timeouts.h" |
| 25 #include "base/threading/platform_thread.h" | 25 #include "base/threading/platform_thread.h" |
| 26 #include "base/version.h" | 26 #include "base/version.h" |
| 27 #include "base/win/registry.h" | 27 #include "base/win/registry.h" |
| 28 #include "base/win/scoped_handle.h" | 28 #include "base/win/scoped_handle.h" |
| 29 #include "base/win/windows_version.h" | 29 #include "base/win/windows_version.h" |
| 30 #include "chrome/install_static/install_details.h" |
| 30 #include "chrome/installer/setup/installer_state.h" | 31 #include "chrome/installer/setup/installer_state.h" |
| 31 #include "chrome/installer/setup/setup_constants.h" | 32 #include "chrome/installer/setup/setup_constants.h" |
| 32 #include "chrome/installer/setup/setup_util.h" | 33 #include "chrome/installer/setup/setup_util.h" |
| 33 #include "chrome/installer/util/browser_distribution.h" | 34 #include "chrome/installer/util/browser_distribution.h" |
| 34 #include "chrome/installer/util/google_update_constants.h" | 35 #include "chrome/installer/util/google_update_constants.h" |
| 35 #include "chrome/installer/util/install_util.h" | |
| 36 #include "chrome/installer/util/installation_state.h" | 36 #include "chrome/installer/util/installation_state.h" |
| 37 #include "chrome/installer/util/updating_app_registration_data.h" | 37 #include "chrome/installer/util/updating_app_registration_data.h" |
| 38 #include "chrome/installer/util/util_constants.h" | 38 #include "chrome/installer/util/util_constants.h" |
| 39 #include "testing/gtest/include/gtest/gtest.h" | 39 #include "testing/gtest/include/gtest/gtest.h" |
| 40 | 40 |
| 41 namespace { | 41 namespace { |
| 42 | 42 |
| 43 // The privilege tested in ScopeTokenPrivilege tests below. | 43 // The privilege tested in ScopeTokenPrivilege tests below. |
| 44 // Use SE_RESTORE_NAME as it is one of the many privileges that is available, | 44 // Use SE_RESTORE_NAME as it is one of the many privileges that is available, |
| 45 // but not enabled by default on processes running at high integrity. | 45 // but not enabled by default on processes running at high integrity. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 TEST(SetupUtilTest, RegisterEventLogProvider) { | 198 TEST(SetupUtilTest, RegisterEventLogProvider) { |
| 199 registry_util::RegistryOverrideManager registry_override_manager; | 199 registry_util::RegistryOverrideManager registry_override_manager; |
| 200 ASSERT_NO_FATAL_FAILURE( | 200 ASSERT_NO_FATAL_FAILURE( |
| 201 registry_override_manager.OverrideRegistry(HKEY_LOCAL_MACHINE)); | 201 registry_override_manager.OverrideRegistry(HKEY_LOCAL_MACHINE)); |
| 202 | 202 |
| 203 const base::Version version("1.2.3.4"); | 203 const base::Version version("1.2.3.4"); |
| 204 const base::FilePath install_directory( | 204 const base::FilePath install_directory( |
| 205 FILE_PATH_LITERAL("c:\\some_path\\test")); | 205 FILE_PATH_LITERAL("c:\\some_path\\test")); |
| 206 installer::RegisterEventLogProvider(install_directory, version); | 206 installer::RegisterEventLogProvider(install_directory, version); |
| 207 | 207 |
| 208 // TODO(grt): use install_static::InstallDetails::Get().install_full_name() | |
| 209 // when InstallDetails is initialized in the installer. | |
| 210 base::string16 reg_path( | 208 base::string16 reg_path( |
| 211 L"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\"); | 209 L"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\"); |
| 212 #if defined(GOOGLE_CHROME_BUILD) | 210 reg_path.append(install_static::InstallDetails::Get().install_full_name()); |
| 213 reg_path.append(L"Chrome"); | |
| 214 if (InstallUtil::IsChromeSxSProcess()) | |
| 215 reg_path.append(L" SxS"); | |
| 216 #else | |
| 217 reg_path.append(L"Chromium"); | |
| 218 #endif | |
| 219 base::win::RegKey key; | 211 base::win::RegKey key; |
| 220 ASSERT_EQ(ERROR_SUCCESS, | 212 ASSERT_EQ(ERROR_SUCCESS, |
| 221 key.Open(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ)); | 213 key.Open(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ)); |
| 222 EXPECT_TRUE(key.HasValue(L"CategoryCount")); | 214 EXPECT_TRUE(key.HasValue(L"CategoryCount")); |
| 223 EXPECT_TRUE(key.HasValue(L"TypesSupported")); | 215 EXPECT_TRUE(key.HasValue(L"TypesSupported")); |
| 224 EXPECT_TRUE(key.HasValue(L"CategoryMessageFile")); | 216 EXPECT_TRUE(key.HasValue(L"CategoryMessageFile")); |
| 225 EXPECT_TRUE(key.HasValue(L"EventMessageFile")); | 217 EXPECT_TRUE(key.HasValue(L"EventMessageFile")); |
| 226 EXPECT_TRUE(key.HasValue(L"ParameterMessageFile")); | 218 EXPECT_TRUE(key.HasValue(L"ParameterMessageFile")); |
| 227 base::string16 value; | 219 base::string16 value; |
| 228 EXPECT_EQ(ERROR_SUCCESS, key.ReadValue(L"CategoryMessageFile", &value)); | 220 EXPECT_EQ(ERROR_SUCCESS, key.ReadValue(L"CategoryMessageFile", &value)); |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 EXPECT_FALSE(HasBinariesVersionKey()); | 763 EXPECT_FALSE(HasBinariesVersionKey()); |
| 772 #if defined(GOOGLE_CHROME_BUILD) | 764 #if defined(GOOGLE_CHROME_BUILD) |
| 773 EXPECT_FALSE(HasMultiGCFVersionKey()); | 765 EXPECT_FALSE(HasMultiGCFVersionKey()); |
| 774 EXPECT_FALSE(HasAppLauncherVersionKey()); | 766 EXPECT_FALSE(HasAppLauncherVersionKey()); |
| 775 EXPECT_FALSE(HasAppHostExe()); | 767 EXPECT_FALSE(HasAppHostExe()); |
| 776 EXPECT_FALSE(HasInstallExtensionCommand()); | 768 EXPECT_FALSE(HasInstallExtensionCommand()); |
| 777 #endif // GOOGLE_CHROME_BUILD | 769 #endif // GOOGLE_CHROME_BUILD |
| 778 } | 770 } |
| 779 | 771 |
| 780 } // namespace installer | 772 } // namespace installer |
| OLD | NEW |