OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/chrome_mini_installer.h" | 5 #include "chrome/test/mini_installer_test/chrome_mini_installer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/platform_thread.h" | 10 #include "base/platform_thread.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 std::wstring uninstall_args = L"\"" + uninstall_path + | 211 std::wstring uninstall_args = L"\"" + uninstall_path + |
212 L"\"" + L" -uninstall"; | 212 L"\"" + L" -uninstall"; |
213 if (install_type_ == mini_installer_constants::kSystemInstall) | 213 if (install_type_ == mini_installer_constants::kSystemInstall) |
214 uninstall_args = uninstall_args + L" -system-level"; | 214 uninstall_args = uninstall_args + L" -system-level"; |
215 base::LaunchApp(uninstall_args, false, false, NULL); | 215 base::LaunchApp(uninstall_args, false, false, NULL); |
216 printf("Launched setup.exe -uninstall....\n"); | 216 printf("Launched setup.exe -uninstall....\n"); |
217 ASSERT_TRUE(CloseUninstallWindow()); | 217 ASSERT_TRUE(CloseUninstallWindow()); |
218 WaitUntilProcessStopsRunning( | 218 WaitUntilProcessStopsRunning( |
219 mini_installer_constants::kChromeSetupExecutable); | 219 mini_installer_constants::kChromeSetupExecutable); |
220 printf("\n\nUninstall Checks:\n\n"); | 220 printf("\n\nUninstall Checks:\n\n"); |
221 ASSERT_FALSE(CheckRegistryKey(dist->GetVersionKey())); | 221 ASSERT_FALSE(CheckRegistryKeyOnUninstall(dist->GetVersionKey())); |
222 DeleteAppFolder(); | 222 DeleteAppFolder(); |
223 FindChromeShortcut(); | 223 FindChromeShortcut(); |
224 CloseProcesses(mini_installer_constants::kIEExecutable); | 224 CloseProcesses(mini_installer_constants::kIEExecutable); |
225 ASSERT_EQ(0, | 225 ASSERT_EQ(0, |
226 base::GetProcessCount(mini_installer_constants::kIEExecutable, NULL)); | 226 base::GetProcessCount(mini_installer_constants::kIEExecutable, NULL)); |
227 } | 227 } |
228 | 228 |
229 bool ChromeMiniInstaller::CloseWindow(const wchar_t* window_name, | 229 bool ChromeMiniInstaller::CloseWindow(const wchar_t* window_name, |
230 UINT message) { | 230 UINT message) { |
231 int timer = 0; | 231 int timer = 0; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 if (!key.Open(GetRootRegistryKey(), key_path.c_str(), KEY_ALL_ACCESS)) { | 311 if (!key.Open(GetRootRegistryKey(), key_path.c_str(), KEY_ALL_ACCESS)) { |
312 printf("Cannot open reg key\n"); | 312 printf("Cannot open reg key\n"); |
313 return false; | 313 return false; |
314 } | 314 } |
315 std::wstring reg_key_value_returned; | 315 std::wstring reg_key_value_returned; |
316 if (!GetChromeVersionFromRegistry(®_key_value_returned)) | 316 if (!GetChromeVersionFromRegistry(®_key_value_returned)) |
317 return false; | 317 return false; |
318 return true; | 318 return true; |
319 } | 319 } |
320 | 320 |
| 321 // Checks for Chrome registry keys on uninstall. |
| 322 bool ChromeMiniInstaller::CheckRegistryKeyOnUninstall( |
| 323 const std::wstring& key_path) { |
| 324 RegKey key; |
| 325 int timer = 0; |
| 326 while ((key.Open(GetRootRegistryKey(), key_path.c_str(), KEY_ALL_ACCESS)) && |
| 327 (timer < 20000)) { |
| 328 PlatformThread::Sleep(200); |
| 329 timer = timer + 200; |
| 330 } |
| 331 return CheckRegistryKey(key_path); |
| 332 } |
| 333 |
321 // Deletes App folder after uninstall. | 334 // Deletes App folder after uninstall. |
322 void ChromeMiniInstaller::DeleteAppFolder() { | 335 void ChromeMiniInstaller::DeleteAppFolder() { |
323 std::wstring path = GetChromeInstallDirectoryLocation(); | 336 std::wstring path = GetChromeInstallDirectoryLocation(); |
324 file_util::AppendToPath(&path, mini_installer_constants::kChromeAppDir); | 337 file_util::AppendToPath(&path, mini_installer_constants::kChromeAppDir); |
325 file_util::UpOneDirectory(&path); | 338 file_util::UpOneDirectory(&path); |
326 printf("Deleting this path after uninstall%ls\n", path.c_str()); | 339 printf("Deleting this path after uninstall%ls\n", path.c_str()); |
327 if (file_util::PathExists(path)) | 340 if (file_util::PathExists(path)) |
328 ASSERT_TRUE(file_util::Delete(path.c_str(), true)); | 341 ASSERT_TRUE(file_util::Delete(path.c_str(), true)); |
329 } | 342 } |
330 | 343 |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 while ((base::GetProcessCount(process_name, NULL) > 0) && | 681 while ((base::GetProcessCount(process_name, NULL) > 0) && |
669 (timer < 60000)) { | 682 (timer < 60000)) { |
670 PlatformThread::Sleep(200); | 683 PlatformThread::Sleep(200); |
671 timer = timer + 200; | 684 timer = timer + 200; |
672 } | 685 } |
673 } | 686 } |
674 else { | 687 else { |
675 ASSERT_EQ(0, base::GetProcessCount(process_name, NULL)); | 688 ASSERT_EQ(0, base::GetProcessCount(process_name, NULL)); |
676 } | 689 } |
677 } | 690 } |
OLD | NEW |