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