OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "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/platform_thread.h" | 9 #include "base/platform_thread.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 while ((key.Open(GetRootRegistryKey(), key_path.c_str(), KEY_ALL_ACCESS)) && | 346 while ((key.Open(GetRootRegistryKey(), key_path.c_str(), KEY_ALL_ACCESS)) && |
347 (timer < 20000)) { | 347 (timer < 20000)) { |
348 PlatformThread::Sleep(200); | 348 PlatformThread::Sleep(200); |
349 timer = timer + 200; | 349 timer = timer + 200; |
350 } | 350 } |
351 return CheckRegistryKey(key_path); | 351 return CheckRegistryKey(key_path); |
352 } | 352 } |
353 | 353 |
354 // Deletes Installer folder from Applications directory. | 354 // Deletes Installer folder from Applications directory. |
355 void ChromeMiniInstaller::DeleteFolder(const wchar_t* folder_name) { | 355 void ChromeMiniInstaller::DeleteFolder(const wchar_t* folder_name) { |
356 std::wstring install_path = GetChromeInstallDirectoryLocation(); | 356 FilePath install_path(GetChromeInstallDirectoryLocation()); |
357 if (wcscmp(folder_name, L"version_folder") == 0) { | 357 if (wcscmp(folder_name, L"version_folder") == 0) { |
358 std::wstring delete_path; | 358 std::wstring delete_path; |
359 delete_path = mini_installer_constants::kChromeAppDir; | 359 delete_path = mini_installer_constants::kChromeAppDir; |
360 std::wstring build_number; | 360 std::wstring build_number; |
361 GetChromeVersionFromRegistry(&build_number); | 361 GetChromeVersionFromRegistry(&build_number); |
362 delete_path = delete_path + build_number; | 362 delete_path = delete_path + build_number; |
363 file_util::AppendToPath(&install_path, delete_path); | 363 install_path = install_path.Append(delete_path); |
364 } else if (wcscmp(folder_name, | 364 } else if (wcscmp(folder_name, |
365 mini_installer_constants::kChromeAppDir) == 0) { | 365 mini_installer_constants::kChromeAppDir) == 0) { |
366 file_util::AppendToPath(&install_path, folder_name); | 366 install_path = install_path.Append(folder_name).StripTrailingSeparators(); |
367 file_util::TrimTrailingSeparator(&install_path); | |
368 } | 367 } |
369 printf("This path will be deleted: %ls\n", install_path.c_str()); | 368 printf("This path will be deleted: %ls\n", install_path.value().c_str()); |
370 ASSERT_TRUE(file_util::Delete(install_path.c_str(), true)); | 369 ASSERT_TRUE(file_util::Delete(install_path, true)); |
371 } | 370 } |
372 | 371 |
373 // Will delete user data profile. | 372 // Will delete user data profile. |
374 void ChromeMiniInstaller::DeleteUserDataFolder() { | 373 void ChromeMiniInstaller::DeleteUserDataFolder() { |
375 FilePath path; | 374 FilePath path; |
376 PathService::Get(base::DIR_LOCAL_APP_DATA, &path); | 375 PathService::Get(base::DIR_LOCAL_APP_DATA, &path); |
377 std::wstring profile_path = path.ToWStringHack(); | 376 std::wstring profile_path = path.ToWStringHack(); |
378 file_util::AppendToPath(&profile_path, | 377 file_util::AppendToPath(&profile_path, |
379 mini_installer_constants::kChromeAppDir); | 378 mini_installer_constants::kChromeAppDir); |
380 file_util::UpOneDirectory(&profile_path); | 379 file_util::UpOneDirectory(&profile_path); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 // This method will verify if the installed build is correct. | 548 // This method will verify if the installed build is correct. |
550 bool ChromeMiniInstaller::VerifyStandaloneInstall() { | 549 bool ChromeMiniInstaller::VerifyStandaloneInstall() { |
551 std::wstring reg_key_value_returned, standalone_installer_version; | 550 std::wstring reg_key_value_returned, standalone_installer_version; |
552 MiniInstallerTestUtil::GetStandaloneVersion(&standalone_installer_version); | 551 MiniInstallerTestUtil::GetStandaloneVersion(&standalone_installer_version); |
553 GetChromeVersionFromRegistry(®_key_value_returned); | 552 GetChromeVersionFromRegistry(®_key_value_returned); |
554 if (standalone_installer_version.compare(reg_key_value_returned) == 0) | 553 if (standalone_installer_version.compare(reg_key_value_returned) == 0) |
555 return true; | 554 return true; |
556 else | 555 else |
557 return false; | 556 return false; |
558 } | 557 } |
OLD | NEW |