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.h" | 9 #include "base/process.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 return GetInstallDirectory(system_level, | 80 return GetInstallDirectory(system_level, |
81 BrowserDistribution::CHROME_BROWSER, path); | 81 BrowserDistribution::CHROME_BROWSER, path); |
82 } | 82 } |
83 | 83 |
84 bool GetInstallDirectory(bool system_level, | 84 bool GetInstallDirectory(bool system_level, |
85 BrowserDistribution::Type type, base::FilePath* path) { | 85 BrowserDistribution::Type type, base::FilePath* path) { |
86 BrowserDistribution* dist = | 86 BrowserDistribution* dist = |
87 BrowserDistribution::GetSpecificDistribution(type); | 87 BrowserDistribution::GetSpecificDistribution(type); |
88 *path = installer::GetChromeInstallPath(system_level, dist); | 88 *path = installer::GetChromeInstallPath(system_level, dist); |
89 base::FilePath parent; | 89 base::FilePath parent; |
90 if (system_level) { | 90 if (system_level) |
91 PathService::Get(base::DIR_PROGRAM_FILES, &parent); | 91 PathService::Get(base::DIR_PROGRAM_FILES, &parent); |
92 return file_util::ContainsPath(parent, *path); | 92 else |
93 } else { | |
94 PathService::Get(base::DIR_LOCAL_APP_DATA, &parent); | 93 PathService::Get(base::DIR_LOCAL_APP_DATA, &parent); |
95 return file_util::ContainsPath(parent, *path); | 94 return parent.IsParent(*path); |
96 } | |
97 } | 95 } |
98 | 96 |
99 bool GetInstalledProducts( | 97 bool GetInstalledProducts( |
100 std::vector<installer_test::InstalledProduct>* products) { | 98 std::vector<installer_test::InstalledProduct>* products) { |
101 // Clear out the products list. | 99 // Clear out the products list. |
102 products->clear(); | 100 products->clear(); |
103 // Check user-level and system-level for products. | 101 // Check user-level and system-level for products. |
104 BrowserDistribution* current_dist; | 102 BrowserDistribution* current_dist; |
105 installer_test::InstalledProduct current_prod; | 103 installer_test::InstalledProduct current_prod; |
106 for (int i = 0; i < 2; ++i) { | 104 for (int i = 0; i < 2; ++i) { |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 return false; | 291 return false; |
294 } | 292 } |
295 if (!base::WaitForSingleProcess(process, base::TimeDelta::FromMinutes(1))) { | 293 if (!base::WaitForSingleProcess(process, base::TimeDelta::FromMinutes(1))) { |
296 LOG(ERROR) << "Launched process did not complete."; | 294 LOG(ERROR) << "Launched process did not complete."; |
297 return false; | 295 return false; |
298 } | 296 } |
299 return true; | 297 return true; |
300 } | 298 } |
301 | 299 |
302 } // namespace | 300 } // namespace |
OLD | NEW |