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