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/test/webdriver/webdriver_automation.h" | 5 #include "chrome/test/webdriver/webdriver_automation.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 base::win::RegKey sys_key(HKEY_LOCAL_MACHINE, kSubKey, KEY_READ); | 122 base::win::RegKey sys_key(HKEY_LOCAL_MACHINE, kSubKey, KEY_READ); |
123 if (sys_key.ReadValue(L"path", &path) == ERROR_SUCCESS) | 123 if (sys_key.ReadValue(L"path", &path) == ERROR_SUCCESS) |
124 locations.push_back(base::FilePath(path)); | 124 locations.push_back(base::FilePath(path)); |
125 | 125 |
126 // Add the user-level location for Chrome. | 126 // Add the user-level location for Chrome. |
127 base::FilePath app_from_google(L"Google\\Chrome\\Application"); | 127 base::FilePath app_from_google(L"Google\\Chrome\\Application"); |
128 base::FilePath app_from_chromium(L"Chromium\\Application"); | 128 base::FilePath app_from_chromium(L"Chromium\\Application"); |
129 scoped_ptr<base::Environment> env(base::Environment::Create()); | 129 scoped_ptr<base::Environment> env(base::Environment::Create()); |
130 std::string home_dir; | 130 std::string home_dir; |
131 if (env->GetVar("userprofile", &home_dir)) { | 131 if (env->GetVar("userprofile", &home_dir)) { |
132 base::FilePath default_location(UTF8ToWide(home_dir)); | 132 base::FilePath default_location(base::UTF8ToWide(home_dir)); |
133 if (base::win::GetVersion() < base::win::VERSION_VISTA) { | 133 if (base::win::GetVersion() < base::win::VERSION_VISTA) { |
134 default_location = default_location.Append( | 134 default_location = default_location.Append( |
135 L"Local Settings\\Application Data"); | 135 L"Local Settings\\Application Data"); |
136 } else { | 136 } else { |
137 default_location = default_location.Append(L"AppData\\Local"); | 137 default_location = default_location.Append(L"AppData\\Local"); |
138 } | 138 } |
139 locations.push_back(default_location.Append(app_from_google)); | 139 locations.push_back(default_location.Append(app_from_google)); |
140 chromium_locations.push_back(default_location.Append(app_from_chromium)); | 140 chromium_locations.push_back(default_location.Append(app_from_chromium)); |
141 } | 141 } |
142 | 142 |
143 // Add the system-level location for Chrome. | 143 // Add the system-level location for Chrome. |
144 std::string program_dir; | 144 std::string program_dir; |
145 if (env->GetVar("ProgramFiles", &program_dir)) { | 145 if (env->GetVar("ProgramFiles", &program_dir)) { |
146 locations.push_back(base::FilePath(UTF8ToWide(program_dir)) | 146 locations.push_back(base::FilePath(base::UTF8ToWide(program_dir)) |
147 .Append(app_from_google)); | 147 .Append(app_from_google)); |
148 chromium_locations.push_back(base::FilePath(UTF8ToWide(program_dir)) | 148 chromium_locations.push_back(base::FilePath(base::UTF8ToWide(program_dir)) |
149 .Append(app_from_chromium)); | 149 .Append(app_from_chromium)); |
150 } | 150 } |
151 if (env->GetVar("ProgramFiles(x86)", &program_dir)) { | 151 if (env->GetVar("ProgramFiles(x86)", &program_dir)) { |
152 locations.push_back(base::FilePath(UTF8ToWide(program_dir)) | 152 locations.push_back(base::FilePath(base::UTF8ToWide(program_dir)) |
153 .Append(app_from_google)); | 153 .Append(app_from_google)); |
154 chromium_locations.push_back(base::FilePath(UTF8ToWide(program_dir)) | 154 chromium_locations.push_back(base::FilePath(base::UTF8ToWide(program_dir)) |
155 .Append(app_from_chromium)); | 155 .Append(app_from_chromium)); |
156 } | 156 } |
157 #elif defined(OS_MACOSX) | 157 #elif defined(OS_MACOSX) |
158 std::vector<base::FilePath> app_dirs; | 158 std::vector<base::FilePath> app_dirs; |
159 webdriver::GetApplicationDirs(&app_dirs); | 159 webdriver::GetApplicationDirs(&app_dirs); |
160 locations.insert(locations.end(), app_dirs.begin(), app_dirs.end()); | 160 locations.insert(locations.end(), app_dirs.begin(), app_dirs.end()); |
161 #elif defined(OS_LINUX) | 161 #elif defined(OS_LINUX) |
162 locations.push_back(base::FilePath("/opt/google/chrome")); | 162 locations.push_back(base::FilePath("/opt/google/chrome")); |
163 locations.push_back(base::FilePath("/usr/local/bin")); | 163 locations.push_back(base::FilePath("/usr/local/bin")); |
164 locations.push_back(base::FilePath("/usr/local/sbin")); | 164 locations.push_back(base::FilePath("/usr/local/sbin")); |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 !file_util::Delete(temp_file, false /* recursive */)) { | 443 !file_util::Delete(temp_file, false /* recursive */)) { |
444 *error = new Error(kUnknownError, "Could not create temporary filename"); | 444 *error = new Error(kUnknownError, "Could not create temporary filename"); |
445 return; | 445 return; |
446 } | 446 } |
447 channel_id = temp_file.value(); | 447 channel_id = temp_file.value(); |
448 #endif | 448 #endif |
449 } | 449 } |
450 if (channel_id.empty()) { | 450 if (channel_id.empty()) { |
451 std::string command_line_str; | 451 std::string command_line_str; |
452 #if defined(OS_WIN) | 452 #if defined(OS_WIN) |
453 command_line_str = WideToUTF8(command.GetCommandLineString()); | 453 command_line_str = base::WideToUTF8(command.GetCommandLineString()); |
454 #elif defined(OS_POSIX) | 454 #elif defined(OS_POSIX) |
455 command_line_str = command.GetCommandLineString(); | 455 command_line_str = command.GetCommandLineString(); |
456 #endif | 456 #endif |
457 logger_.Log(kInfoLogLevel, "Launching chrome: " + command_line_str); | 457 logger_.Log(kInfoLogLevel, "Launching chrome: " + command_line_str); |
458 launcher_.reset(new WebDriverAnonymousProxyLauncher()); | 458 launcher_.reset(new WebDriverAnonymousProxyLauncher()); |
459 } else { | 459 } else { |
460 logger_.Log(kInfoLogLevel, "Using named testing interface"); | 460 logger_.Log(kInfoLogLevel, "Using named testing interface"); |
461 launcher_.reset(new WebDriverNamedProxyLauncher( | 461 launcher_.reset(new WebDriverNamedProxyLauncher( |
462 channel_id, launch_browser)); | 462 channel_id, launch_browser)); |
463 } | 463 } |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 } | 1204 } |
1205 | 1205 |
1206 Error* Automation::CheckMaximizeSupported() { | 1206 Error* Automation::CheckMaximizeSupported() { |
1207 const char* message = | 1207 const char* message = |
1208 "Maximize automation interface is not supported for this version of " | 1208 "Maximize automation interface is not supported for this version of " |
1209 "Chrome."; | 1209 "Chrome."; |
1210 return CheckVersion(1160, message); | 1210 return CheckVersion(1160, message); |
1211 } | 1211 } |
1212 | 1212 |
1213 } // namespace webdriver | 1213 } // namespace webdriver |
OLD | NEW |