OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 } else { | 170 } else { |
171 CommandLine cmdline((FilePath(path))); | 171 CommandLine cmdline((FilePath(path))); |
172 cmdline.AppendArgNative(argument); | 172 cmdline.AppendArgNative(argument); |
173 if (!base::LaunchProcess(cmdline, base::LaunchOptions(), &process)) { | 173 if (!base::LaunchProcess(cmdline, base::LaunchOptions(), &process)) { |
174 LOG(ERROR) << "LaunchProcess failed: " << ::GetLastError(); | 174 LOG(ERROR) << "LaunchProcess failed: " << ::GetLastError(); |
175 } | 175 } |
176 } | 176 } |
177 return process; | 177 return process; |
178 } | 178 } |
179 | 179 |
180 base::ProcessHandle LaunchChrome(const std::wstring& url) { | 180 base::ProcessHandle LaunchChrome(const std::wstring& url, |
| 181 const FilePath& user_data_dir) { |
181 FilePath path; | 182 FilePath path; |
182 PathService::Get(base::DIR_MODULE, &path); | 183 PathService::Get(base::DIR_MODULE, &path); |
183 path = path.AppendASCII(kChromeImageName); | 184 path = path.AppendASCII(kChromeImageName); |
184 | 185 |
185 CommandLine cmd(path); | 186 CommandLine cmd(path); |
186 cmd.AppendSwitch(switches::kNoFirstRun); | 187 cmd.AppendSwitch(switches::kNoFirstRun); |
| 188 if (!user_data_dir.empty()) |
| 189 cmd.AppendSwitchPath(switches::kUserDataDir, user_data_dir); |
187 cmd.AppendArgNative(url); | 190 cmd.AppendArgNative(url); |
188 | 191 |
189 base::ProcessHandle process = NULL; | 192 base::ProcessHandle process = NULL; |
190 base::LaunchProcess(cmd, base::LaunchOptions(), &process); | 193 base::LaunchProcess(cmd, base::LaunchOptions(), &process); |
191 return process; | 194 return process; |
192 } | 195 } |
193 | 196 |
194 base::ProcessHandle LaunchIEOnVista(const std::wstring& url) { | 197 base::ProcessHandle LaunchIEOnVista(const std::wstring& url) { |
195 typedef HRESULT (WINAPI* IELaunchURLPtr)(const wchar_t* url, | 198 typedef HRESULT (WINAPI* IELaunchURLPtr)(const wchar_t* url, |
196 PROCESS_INFORMATION* pi, | 199 PROCESS_INFORMATION* pi, |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 if (!PathService::Get(base::DIR_LOCAL_APP_DATA, &session_history_path)) | 667 if (!PathService::Get(base::DIR_LOCAL_APP_DATA, &session_history_path)) |
665 return; | 668 return; |
666 | 669 |
667 session_history_path = session_history_path.AppendASCII("Microsoft"); | 670 session_history_path = session_history_path.AppendASCII("Microsoft"); |
668 session_history_path = session_history_path.AppendASCII("Internet Explorer"); | 671 session_history_path = session_history_path.AppendASCII("Internet Explorer"); |
669 session_history_path = session_history_path.AppendASCII("Recovery"); | 672 session_history_path = session_history_path.AppendASCII("Recovery"); |
670 file_util::Delete(session_history_path, true); | 673 file_util::Delete(session_history_path, true); |
671 } | 674 } |
672 | 675 |
673 } // namespace chrome_frame_test | 676 } // namespace chrome_frame_test |
OLD | NEW |