| 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 27 matching lines...) Expand all Loading... |
| 38 const DWORD kCrashServicePipeDesiredAccess = FILE_READ_DATA | | 38 const DWORD kCrashServicePipeDesiredAccess = FILE_READ_DATA | |
| 39 FILE_WRITE_DATA | | 39 FILE_WRITE_DATA | |
| 40 FILE_WRITE_ATTRIBUTES; | 40 FILE_WRITE_ATTRIBUTES; |
| 41 | 41 |
| 42 const DWORD kCrashServicePipeFlagsAndAttributes = SECURITY_IDENTIFICATION | | 42 const DWORD kCrashServicePipeFlagsAndAttributes = SECURITY_IDENTIFICATION | |
| 43 SECURITY_SQOS_PRESENT; | 43 SECURITY_SQOS_PRESENT; |
| 44 const int kCrashServiceStartupTimeoutMs = 500; | 44 const int kCrashServiceStartupTimeoutMs = 500; |
| 45 | 45 |
| 46 const wchar_t kIEImageName[] = L"iexplore.exe"; | 46 const wchar_t kIEImageName[] = L"iexplore.exe"; |
| 47 const wchar_t kIEBrokerImageName[] = L"ieuser.exe"; | 47 const wchar_t kIEBrokerImageName[] = L"ieuser.exe"; |
| 48 const wchar_t kFirefoxImageName[] = L"firefox.exe"; | |
| 49 const wchar_t kOperaImageName[] = L"opera.exe"; | |
| 50 const wchar_t kSafariImageName[] = L"safari.exe"; | |
| 51 const char kChromeImageName[] = "chrome.exe"; | 48 const char kChromeImageName[] = "chrome.exe"; |
| 52 const wchar_t kIEProfileName[] = L"iexplore"; | 49 const wchar_t kIEProfileName[] = L"iexplore"; |
| 53 const wchar_t kChromeLauncher[] = L"chrome_launcher.exe"; | 50 const wchar_t kChromeLauncher[] = L"chrome_launcher.exe"; |
| 54 const int kChromeFrameLongNavigationTimeoutInSeconds = 10; | 51 const int kChromeFrameLongNavigationTimeoutInSeconds = 10; |
| 55 const int kChromeFrameVeryLongNavigationTimeoutInSeconds = 30; | 52 const int kChromeFrameVeryLongNavigationTimeoutInSeconds = 30; |
| 56 | 53 |
| 57 const wchar_t TempRegKeyOverride::kTempTestKeyPath[] = | 54 const wchar_t TempRegKeyOverride::kTempTestKeyPath[] = |
| 58 L"Software\\Chromium\\TempTestKeys"; | 55 L"Software\\Chromium\\TempTestKeys"; |
| 59 | 56 |
| 60 // Callback function for EnumThreadWindows. | 57 // Callback function for EnumThreadWindows. |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 } else { | 166 } else { |
| 170 CommandLine cmdline((FilePath(path))); | 167 CommandLine cmdline((FilePath(path))); |
| 171 cmdline.AppendArgNative(argument); | 168 cmdline.AppendArgNative(argument); |
| 172 if (!base::LaunchApp(cmdline, false, false, &process)) { | 169 if (!base::LaunchApp(cmdline, false, false, &process)) { |
| 173 LOG(ERROR) << "LaunchApp failed: " << ::GetLastError(); | 170 LOG(ERROR) << "LaunchApp failed: " << ::GetLastError(); |
| 174 } | 171 } |
| 175 } | 172 } |
| 176 return process; | 173 return process; |
| 177 } | 174 } |
| 178 | 175 |
| 179 base::ProcessHandle LaunchFirefox(const std::wstring& url) { | |
| 180 return LaunchExecutable(kFirefoxImageName, url); | |
| 181 } | |
| 182 | |
| 183 base::ProcessHandle LaunchSafari(const std::wstring& url) { | |
| 184 return LaunchExecutable(kSafariImageName, url); | |
| 185 } | |
| 186 | |
| 187 base::ProcessHandle LaunchChrome(const std::wstring& url) { | 176 base::ProcessHandle LaunchChrome(const std::wstring& url) { |
| 188 FilePath path; | 177 FilePath path; |
| 189 PathService::Get(base::DIR_MODULE, &path); | 178 PathService::Get(base::DIR_MODULE, &path); |
| 190 path = path.AppendASCII(kChromeImageName); | 179 path = path.AppendASCII(kChromeImageName); |
| 191 | 180 |
| 192 CommandLine cmd(path); | 181 CommandLine cmd(path); |
| 193 cmd.AppendSwitch(switches::kNoFirstRun); | 182 cmd.AppendSwitch(switches::kNoFirstRun); |
| 194 cmd.AppendArgNative(url); | 183 cmd.AppendArgNative(url); |
| 195 | 184 |
| 196 base::ProcessHandle process = NULL; | 185 base::ProcessHandle process = NULL; |
| 197 base::LaunchApp(cmd, false, false, &process); | 186 base::LaunchApp(cmd, false, false, &process); |
| 198 return process; | 187 return process; |
| 199 } | 188 } |
| 200 | 189 |
| 201 base::ProcessHandle LaunchOpera(const std::wstring& url) { | |
| 202 // NOTE: For Opera tests to work it must be configured to start up with | |
| 203 // a blank page. There is an command line switch, -nosession, that's supposed | |
| 204 // to avoid opening up the previous session, but that switch is not working. | |
| 205 // TODO(tommi): Include a special ini file (opera6.ini) for opera and launch | |
| 206 // with our required settings. This file is by default stored here: | |
| 207 // "%USERPROFILE%\Application Data\Opera\Opera\profile\opera6.ini" | |
| 208 return LaunchExecutable(kOperaImageName, url); | |
| 209 } | |
| 210 | |
| 211 base::ProcessHandle LaunchIEOnVista(const std::wstring& url) { | 190 base::ProcessHandle LaunchIEOnVista(const std::wstring& url) { |
| 212 typedef HRESULT (WINAPI* IELaunchURLPtr)( | 191 typedef HRESULT (WINAPI* IELaunchURLPtr)( |
| 213 const wchar_t* url, | 192 const wchar_t* url, |
| 214 PROCESS_INFORMATION *pi, | 193 PROCESS_INFORMATION *pi, |
| 215 VOID *info); | 194 VOID *info); |
| 216 | 195 |
| 217 IELaunchURLPtr launch; | 196 IELaunchURLPtr launch; |
| 218 PROCESS_INFORMATION pi = {0}; | 197 PROCESS_INFORMATION pi = {0}; |
| 219 IELAUNCHURLINFO info = {sizeof info, 0}; | 198 IELAUNCHURLINFO info = {sizeof info, 0}; |
| 220 HMODULE h = LoadLibrary(L"ieframe.dll"); | 199 HMODULE h = LoadLibrary(L"ieframe.dll"); |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 wchar_t local_app_data_path[MAX_PATH + 1] = {0}; | 674 wchar_t local_app_data_path[MAX_PATH + 1] = {0}; |
| 696 SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, | 675 SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, |
| 697 local_app_data_path); | 676 local_app_data_path); |
| 698 | 677 |
| 699 std::wstring session_history_path = local_app_data_path; | 678 std::wstring session_history_path = local_app_data_path; |
| 700 session_history_path += L"\\Microsoft\\Internet Explorer\\Recovery"; | 679 session_history_path += L"\\Microsoft\\Internet Explorer\\Recovery"; |
| 701 file_util::Delete(session_history_path, true); | 680 file_util::Delete(session_history_path, true); |
| 702 } | 681 } |
| 703 | 682 |
| 704 } // namespace chrome_frame_test | 683 } // namespace chrome_frame_test |
| OLD | NEW |