| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/process_util.h" | 7 #include "base/process_util.h" |
| 8 #include "base/test/test_suite.h" | 8 #include "base/test/test_suite.h" |
| 9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 base::FilePath path; | 22 base::FilePath path; |
| 23 installer_test::GetChromeInstallDirectory(false /* system_level */, &path); | 23 installer_test::GetChromeInstallDirectory(false /* system_level */, &path); |
| 24 path = path.Append(mini_installer_constants::kChromeAppDir).DirName(); | 24 path = path.Append(mini_installer_constants::kChromeAppDir).DirName(); |
| 25 base::FilePath backup_path = path; | 25 base::FilePath backup_path = path; |
| 26 // Will hold User Data path that needs to be backed-up. | 26 // Will hold User Data path that needs to be backed-up. |
| 27 path = path.Append(mini_installer_constants::kChromeUserDataDir); | 27 path = path.Append(mini_installer_constants::kChromeUserDataDir); |
| 28 // Will hold new backup path to save the profile. | 28 // Will hold new backup path to save the profile. |
| 29 backup_path = backup_path.Append( | 29 backup_path = backup_path.Append( |
| 30 mini_installer_constants::kChromeUserDataBackupDir); | 30 mini_installer_constants::kChromeUserDataBackupDir); |
| 31 // Will check if User Data profile is available. | 31 // Will check if User Data profile is available. |
| 32 if (file_util::PathExists(path)) { | 32 if (base::PathExists(path)) { |
| 33 // Will check if User Data is already backed up. | 33 // Will check if User Data is already backed up. |
| 34 // If yes, will delete and create new one. | 34 // If yes, will delete and create new one. |
| 35 if (file_util::PathExists(backup_path)) | 35 if (base::PathExists(backup_path)) |
| 36 base::Delete(backup_path, true); | 36 base::Delete(backup_path, true); |
| 37 base::CopyDirectory(path, backup_path, true); | 37 base::CopyDirectory(path, backup_path, true); |
| 38 } else { | 38 } else { |
| 39 printf("Chrome is not installed. Will not take any backup\n"); | 39 printf("Chrome is not installed. Will not take any backup\n"); |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 | 42 |
| 43 int main(int argc, char** argv) { | 43 int main(int argc, char** argv) { |
| 44 // Check command line to decide if the tests should continue | 44 // Check command line to decide if the tests should continue |
| 45 // with cleaning the system or make a backup before continuing. | 45 // with cleaning the system or make a backup before continuing. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 67 installer::switches::kChromeFrame)); | 67 installer::switches::kChromeFrame)); |
| 68 } | 68 } |
| 69 | 69 |
| 70 if (base::win::GetVersion() < base::win::VERSION_VISTA || | 70 if (base::win::GetVersion() < base::win::VERSION_VISTA || |
| 71 command_line.HasSwitch(switches::kInstallerTestForce)) { | 71 command_line.HasSwitch(switches::kInstallerTestForce)) { |
| 72 return test_suite.Run(); | 72 return test_suite.Run(); |
| 73 } | 73 } |
| 74 printf("These tests don't run on this platform.\n"); | 74 printf("These tests don't run on this platform.\n"); |
| 75 return 0; | 75 return 0; |
| 76 } | 76 } |
| OLD | NEW |