OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome_frame/test/chrome_frame_test_utils.h" | 5 #include "chrome_frame/test/chrome_frame_test_utils.h" |
6 | 6 |
7 #include <atlapp.h> | 7 #include <atlapp.h> |
8 #include <atlmisc.h> | 8 #include <atlmisc.h> |
9 #include <iepmapi.h> | 9 #include <iepmapi.h> |
10 #include <sddl.h> | 10 #include <sddl.h> |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 base::ProcessHandle LaunchExecutable(const std::wstring& executable, | 152 base::ProcessHandle LaunchExecutable(const std::wstring& executable, |
153 const std::wstring& argument) { | 153 const std::wstring& argument) { |
154 base::ProcessHandle process = NULL; | 154 base::ProcessHandle process = NULL; |
155 std::wstring path = GetExecutableAppPath(executable); | 155 std::wstring path = GetExecutableAppPath(executable); |
156 if (path.empty()) { | 156 if (path.empty()) { |
157 path = FormatCommandForApp(executable, argument); | 157 path = FormatCommandForApp(executable, argument); |
158 if (path.empty()) { | 158 if (path.empty()) { |
159 LOG(ERROR) << "Failed to find executable: " << executable; | 159 LOG(ERROR) << "Failed to find executable: " << executable; |
160 } else { | 160 } else { |
161 CommandLine cmdline = CommandLine::FromString(path); | 161 CommandLine cmdline = CommandLine::FromString(path); |
162 if (!base::LaunchApp(cmdline, false, false, &process)) { | 162 base::LaunchOptions options; |
163 LOG(ERROR) << "LaunchApp failed: " << ::GetLastError(); | 163 options.process_handle = &process; |
| 164 if (!base::LaunchProcess(cmdline, options)) { |
| 165 LOG(ERROR) << "LaunchProcess failed: " << ::GetLastError(); |
164 } | 166 } |
165 } | 167 } |
166 } else { | 168 } else { |
167 CommandLine cmdline((FilePath(path))); | 169 CommandLine cmdline((FilePath(path))); |
168 cmdline.AppendArgNative(argument); | 170 cmdline.AppendArgNative(argument); |
169 if (!base::LaunchApp(cmdline, false, false, &process)) { | 171 base::LaunchOptions options; |
170 LOG(ERROR) << "LaunchApp failed: " << ::GetLastError(); | 172 options.process_handle = &process; |
| 173 if (!base::LaunchProcess(cmdline, options)) { |
| 174 LOG(ERROR) << "LaunchProcess failed: " << ::GetLastError(); |
171 } | 175 } |
172 } | 176 } |
173 return process; | 177 return process; |
174 } | 178 } |
175 | 179 |
176 base::ProcessHandle LaunchChrome(const std::wstring& url) { | 180 base::ProcessHandle LaunchChrome(const std::wstring& url) { |
177 FilePath path; | 181 FilePath path; |
178 PathService::Get(base::DIR_MODULE, &path); | 182 PathService::Get(base::DIR_MODULE, &path); |
179 path = path.AppendASCII(kChromeImageName); | 183 path = path.AppendASCII(kChromeImageName); |
180 | 184 |
181 CommandLine cmd(path); | 185 CommandLine cmd(path); |
182 cmd.AppendSwitch(switches::kNoFirstRun); | 186 cmd.AppendSwitch(switches::kNoFirstRun); |
183 cmd.AppendArgNative(url); | 187 cmd.AppendArgNative(url); |
184 | 188 |
185 base::ProcessHandle process = NULL; | 189 base::ProcessHandle process = NULL; |
186 base::LaunchApp(cmd, false, false, &process); | 190 base::LaunchOptions options; |
| 191 options.process_handle = &process; |
| 192 base::LaunchProcess(cmd, options); |
187 return process; | 193 return process; |
188 } | 194 } |
189 | 195 |
190 base::ProcessHandle LaunchIEOnVista(const std::wstring& url) { | 196 base::ProcessHandle LaunchIEOnVista(const std::wstring& url) { |
191 typedef HRESULT (WINAPI* IELaunchURLPtr)( | 197 typedef HRESULT (WINAPI* IELaunchURLPtr)( |
192 const wchar_t* url, | 198 const wchar_t* url, |
193 PROCESS_INFORMATION *pi, | 199 PROCESS_INFORMATION *pi, |
194 VOID *info); | 200 VOID *info); |
195 | 201 |
196 IELaunchURLPtr launch; | 202 IELaunchURLPtr launch; |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 if (!PathService::Get(base::DIR_EXE, &exe_dir)) { | 589 if (!PathService::Get(base::DIR_EXE, &exe_dir)) { |
584 DCHECK(false); | 590 DCHECK(false); |
585 return NULL; | 591 return NULL; |
586 } | 592 } |
587 | 593 |
588 base::ProcessHandle crash_service = NULL; | 594 base::ProcessHandle crash_service = NULL; |
589 | 595 |
590 DVLOG(1) << "Starting crash_service.exe so you know if a test crashes!"; | 596 DVLOG(1) << "Starting crash_service.exe so you know if a test crashes!"; |
591 | 597 |
592 FilePath crash_service_path = exe_dir.AppendASCII("crash_service.exe"); | 598 FilePath crash_service_path = exe_dir.AppendASCII("crash_service.exe"); |
593 if (!base::LaunchApp(crash_service_path.value(), false, false, | 599 base::LaunchOptions options; |
594 &crash_service)) { | 600 options.process_handle = &crash_service; |
| 601 if (!base::LaunchProcess(crash_service_path.value(), options)) { |
595 DLOG(ERROR) << "Couldn't start crash_service.exe"; | 602 DLOG(ERROR) << "Couldn't start crash_service.exe"; |
596 return NULL; | 603 return NULL; |
597 } | 604 } |
598 | 605 |
599 base::Time start = base::Time::Now(); | 606 base::Time start = base::Time::Now(); |
600 | 607 |
601 if (DetectRunningCrashService(kCrashServiceStartupTimeoutMs)) { | 608 if (DetectRunningCrashService(kCrashServiceStartupTimeoutMs)) { |
602 DVLOG(1) << "crash_service.exe is ready for clients in " | 609 DVLOG(1) << "crash_service.exe is ready for clients in " |
603 << (base::Time::Now() - start).InMilliseconds() << " ms."; | 610 << (base::Time::Now() - start).InMilliseconds() << " ms."; |
604 return crash_service; | 611 return crash_service; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 wchar_t local_app_data_path[MAX_PATH + 1] = {0}; | 681 wchar_t local_app_data_path[MAX_PATH + 1] = {0}; |
675 SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, | 682 SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, |
676 local_app_data_path); | 683 local_app_data_path); |
677 | 684 |
678 std::wstring session_history_path = local_app_data_path; | 685 std::wstring session_history_path = local_app_data_path; |
679 session_history_path += L"\\Microsoft\\Internet Explorer\\Recovery"; | 686 session_history_path += L"\\Microsoft\\Internet Explorer\\Recovery"; |
680 file_util::Delete(session_history_path, true); | 687 file_util::Delete(session_history_path, true); |
681 } | 688 } |
682 | 689 |
683 } // namespace chrome_frame_test | 690 } // namespace chrome_frame_test |
OLD | NEW |