| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/test/test_suite.h" | 7 #include "base/test/test_suite.h" |
| 8 #include "chrome/common/chrome_switches.h" |
| 8 #include "chrome/installer/util/util_constants.h" | 9 #include "chrome/installer/util/util_constants.h" |
| 9 #include "chrome/test/mini_installer_test/mini_installer_test_constants.h" | 10 #include "chrome/test/mini_installer_test/mini_installer_test_constants.h" |
| 10 #include "chrome_mini_installer.h" | 11 #include "chrome_mini_installer.h" |
| 11 | 12 |
| 12 | |
| 13 void BackUpProfile(bool chrome_frame) { | 13 void BackUpProfile(bool chrome_frame) { |
| 14 if (base::GetProcessCount(L"chrome.exe", NULL) > 0) { | 14 if (base::GetProcessCount(L"chrome.exe", NULL) > 0) { |
| 15 printf("Chrome is currently running and cannot backup the profile." | 15 printf("Chrome is currently running and cannot backup the profile." |
| 16 "Please close Chrome and run the tests again.\n"); | 16 "Please close Chrome and run the tests again.\n"); |
| 17 exit(1); | 17 exit(1); |
| 18 } | 18 } |
| 19 ChromeMiniInstaller installer(mini_installer_constants::kUserInstall, | 19 ChromeMiniInstaller installer(mini_installer_constants::kUserInstall, |
| 20 chrome_frame); | 20 chrome_frame); |
| 21 FilePath path = | 21 FilePath path = |
| 22 FilePath::FromWStringHack(installer.GetChromeInstallDirectoryLocation()); | 22 FilePath::FromWStringHack(installer.GetChromeInstallDirectoryLocation()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 38 printf("Chrome is not installed. Will not take any backup\n"); | 38 printf("Chrome is not installed. Will not take any backup\n"); |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 | 41 |
| 42 int main(int argc, char** argv) { | 42 int main(int argc, char** argv) { |
| 43 // Check command line to decide if the tests should continue | 43 // Check command line to decide if the tests should continue |
| 44 // with cleaning the system or make a backup before continuing. | 44 // with cleaning the system or make a backup before continuing. |
| 45 CommandLine::Init(argc, argv); | 45 CommandLine::Init(argc, argv); |
| 46 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 46 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 47 TestSuite test_suite = TestSuite(argc, argv); | 47 TestSuite test_suite = TestSuite(argc, argv); |
| 48 if (command_line.HasSwitch("clean")) { | 48 if (command_line.HasSwitch(switches::kInstallerTestClean)) { |
| 49 printf("Current version of Chrome will be uninstalled " | 49 printf("Current version of Chrome will be uninstalled " |
| 50 "from all levels before proceeding with tests.\n"); | 50 "from all levels before proceeding with tests.\n"); |
| 51 } else if (command_line.HasSwitch("backup")) { | 51 } else if (command_line.HasSwitch(switches::kInstallerTestForce)) { |
| 52 BackUpProfile(command_line.HasSwitch( | 52 BackUpProfile(command_line.HasSwitch( |
| 53 installer_util::switches::kChromeFrame)); | 53 installer_util::switches::kChromeFrame)); |
| 54 } else { | 54 } else { |
| 55 printf("This test needs command line arguments.\n"); | 55 printf("This test needs command line arguments.\n"); |
| 56 printf("Usage: %ls -{clean|backup} [-build <version>] [-force] \n", | 56 printf("Usage: %ls -{clean|backup} [-build <version>] [-force] \n", |
| 57 command_line.program().c_str()); | 57 command_line.program().c_str()); |
| 58 printf("-clean arg will uninstall your chrome at all levels" | 58 printf("-clean arg will uninstall your chrome at all levels" |
| 59 " and also delete profile.\n" | 59 " and also delete profile.\n" |
| 60 "-backup arg will make a copy of User Data before uninstalling" | 60 "-backup arg will make a copy of User Data before uninstalling" |
| 61 " your chrome at all levels. The copy will be named as" | 61 " your chrome at all levels. The copy will be named as" |
| 62 " User Data Copy.\n" | 62 " User Data Copy.\n" |
| 63 "-build specifies the build to be tested, e.g., 3.0.195.24." | 63 "-build specifies the build to be tested, e.g., 3.0.195.24." |
| 64 " Specifying 'dev' or 'stable' will use the latest build from that" | 64 " Specifying 'dev' or 'stable' will use the latest build from that" |
| 65 " channel. 'latest', the default, will use the latest build.\n" | 65 " channel. 'latest', the default, will use the latest build.\n" |
| 66 "-force allows these tests to be run on the current platform," | 66 "-force allows these tests to be run on the current platform," |
| 67 " regardless of whether it is supported.\n"); | 67 " regardless of whether it is supported.\n"); |
| 68 return 1; | 68 return 1; |
| 69 } | 69 } |
| 70 | 70 |
| 71 return test_suite.Run(); | 71 return test_suite.Run(); |
| 72 } | 72 } |
| OLD | NEW |