Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: chrome/test/mini_installer_test/run_all_unittests.cc

Issue 276016: Remove some deprecated file_util wstring functions. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: lint Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 void BackUpProfile() { 11 void BackUpProfile() {
12 if (base::GetProcessCount(L"chrome.exe", NULL) > 0) { 12 if (base::GetProcessCount(L"chrome.exe", NULL) > 0) {
13 printf("Chrome is currently running and cannot backup the profile." 13 printf("Chrome is currently running and cannot backup the profile."
14 "Please close Chrome and run the tests again.\n"); 14 "Please close Chrome and run the tests again.\n");
15 exit(1); 15 exit(1);
16 } 16 }
17 ChromeMiniInstaller installer(mini_installer_constants::kUserInstall); 17 ChromeMiniInstaller installer(mini_installer_constants::kUserInstall);
18 std::wstring path = installer.GetChromeInstallDirectoryLocation(); 18 FilePath path =
19 file_util::AppendToPath(&path, mini_installer_constants::kChromeAppDir); 19 FilePath::FromWStringHack(installer.GetChromeInstallDirectoryLocation());
20 file_util::UpOneDirectory(&path); 20 path = path.Append(mini_installer_constants::kChromeAppDir).DirName();
21 std::wstring backup_path = path; 21 FilePath backup_path = path;
22 // Will hold User Data path that needs to be backed-up. 22 // Will hold User Data path that needs to be backed-up.
23 file_util::AppendToPath(&path, 23 path = path.Append(mini_installer_constants::kChromeUserDataDir);
24 mini_installer_constants::kChromeUserDataDir);
25 // Will hold new backup path to save the profile. 24 // Will hold new backup path to save the profile.
26 file_util::AppendToPath(&backup_path, 25 backup_path = path.Append(mini_installer_constants::kChromeUserDataBackupDir);
27 mini_installer_constants::kChromeUserDataBackupDir);
28 // Will check if User Data profile is available. 26 // Will check if User Data profile is available.
29 if (file_util::PathExists(path)) { 27 if (file_util::PathExists(path)) {
30 // Will check if User Data is already backed up. 28 // Will check if User Data is already backed up.
31 // If yes, will delete and create new one. 29 // If yes, will delete and create new one.
32 if (file_util::PathExists(backup_path)) 30 if (file_util::PathExists(backup_path))
33 file_util::Delete(backup_path.c_str(), true); 31 file_util::Delete(backup_path, true);
34 file_util::CopyDirectory(path, backup_path, true); 32 file_util::CopyDirectory(path, backup_path, true);
35 } else { 33 } else {
36 printf("Chrome is not installed. Will not take any backup\n"); 34 printf("Chrome is not installed. Will not take any backup\n");
37 } 35 }
38 } 36 }
39 37
40 int main(int argc, char** argv) { 38 int main(int argc, char** argv) {
41 // Check command line to decide if the tests should continue 39 // Check command line to decide if the tests should continue
42 // with cleaning the system or make a backup before continuing. 40 // with cleaning the system or make a backup before continuing.
43 CommandLine::Init(argc, argv); 41 CommandLine::Init(argc, argv);
44 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 42 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
45 if (command_line.HasSwitch("clean")) { 43 if (command_line.HasSwitch("clean")) {
46 printf("Current version of Chrome will be uninstalled " 44 printf("Current version of Chrome will be uninstalled "
47 "from all levels before proceeding with tests.\n"); 45 "from all levels before proceeding with tests.\n");
48 } else if (command_line.HasSwitch("backup")) { 46 } else if (command_line.HasSwitch("backup")) {
49 BackUpProfile(); 47 BackUpProfile();
50 } else { 48 } else {
51 printf("This test needs command line Arguments.\n"); 49 printf("This test needs command line Arguments.\n");
52 printf("Usage: mini_installer_tests.exe -{clean|backup}\n"); 50 printf("Usage: mini_installer_tests.exe -{clean|backup}\n");
53 printf("Note: -clean arg will uninstall your chrome at all levels" 51 printf("Note: -clean arg will uninstall your chrome at all levels"
54 " and also delete profile.\n" 52 " and also delete profile.\n"
55 "-backup arg will make a copy of User Data before uninstalling" 53 "-backup arg will make a copy of User Data before uninstalling"
56 " your chrome at all levels. The copy will be named as" 54 " your chrome at all levels. The copy will be named as"
57 " User Data Copy.\n"); 55 " User Data Copy.\n");
58 exit(1); 56 exit(1);
59 } 57 }
60 return TestSuite(argc, argv).Run(); 58 return TestSuite(argc, argv).Run();
61 } 59 }
OLDNEW
« no previous file with comments | « chrome/test/mini_installer_test/mini_installer_test_util.cc ('k') | chrome/tools/crash_service/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698