| 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/test/mini_installer_test/installer_test_util.h" | 5 #include "chrome/test/mini_installer_test/installer_test_util.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/process/kill.h" | 9 #include "base/process/kill.h" |
| 10 #include "base/process/launch.h" | 10 #include "base/process/launch.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 bool has_install_dir = GetInstallDirectory(system_level, | 58 bool has_install_dir = GetInstallDirectory(system_level, |
| 59 ToBrowserDistributionType(type), | 59 ToBrowserDistributionType(type), |
| 60 &path); | 60 &path); |
| 61 if (!has_install_dir || !base::PathExists(path)) | 61 if (!has_install_dir || !base::PathExists(path)) |
| 62 return false; | 62 return false; |
| 63 path = path.AppendASCII(version); | 63 path = path.AppendASCII(version); |
| 64 return base::DeleteFile(path, true); | 64 return base::DeleteFile(path, true); |
| 65 } | 65 } |
| 66 | 66 |
| 67 bool DeleteRegistryKey(bool system_level, | 67 bool DeleteRegistryKey(bool system_level, |
| 68 InstallationValidator::InstallationType type) { | 68 InstallationValidator::InstallationType type, |
| 69 REGSAM wow64_access) { |
| 69 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution( | 70 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution( |
| 70 ToBrowserDistributionType(type)); | 71 ToBrowserDistributionType(type)); |
| 71 base::FilePath::StringType key(google_update::kRegPathClients); | 72 base::FilePath::StringType key(google_update::kRegPathClients); |
| 72 key.push_back(base::FilePath::kSeparators[0]); | 73 key.push_back(base::FilePath::kSeparators[0]); |
| 73 key.append(dist->GetAppGuid()); | 74 key.append(dist->GetAppGuid()); |
| 74 HKEY root = system_level ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; | 75 HKEY root = system_level ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; |
| 75 return InstallUtil::DeleteRegistryKey(root, key); | 76 LONG result = InstallUtil::DeleteRegistryKey(root, key, wow64_access); |
| 77 return (result == ERROR_SUCCESS || result == ERROR_FILE_NOT_FOUND); |
| 76 } | 78 } |
| 77 | 79 |
| 78 bool GetChromeInstallDirectory(bool system_level, base::FilePath* path) { | 80 bool GetChromeInstallDirectory(bool system_level, base::FilePath* path) { |
| 79 return GetInstallDirectory(system_level, | 81 return GetInstallDirectory(system_level, |
| 80 BrowserDistribution::CHROME_BROWSER, path); | 82 BrowserDistribution::CHROME_BROWSER, path); |
| 81 } | 83 } |
| 82 | 84 |
| 83 bool GetInstallDirectory(bool system_level, | 85 bool GetInstallDirectory(bool system_level, |
| 84 BrowserDistribution::Type type, base::FilePath* path) { | 86 BrowserDistribution::Type type, base::FilePath* path) { |
| 85 BrowserDistribution* dist = | 87 BrowserDistribution* dist = |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 return false; | 292 return false; |
| 291 } | 293 } |
| 292 if (!base::WaitForSingleProcess(process, base::TimeDelta::FromMinutes(1))) { | 294 if (!base::WaitForSingleProcess(process, base::TimeDelta::FromMinutes(1))) { |
| 293 LOG(ERROR) << "Launched process did not complete."; | 295 LOG(ERROR) << "Launched process did not complete."; |
| 294 return false; | 296 return false; |
| 295 } | 297 } |
| 296 return true; | 298 return true; |
| 297 } | 299 } |
| 298 | 300 |
| 299 } // namespace | 301 } // namespace |
| OLD | NEW |