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

Side by Side Diff: chrome/test/webdriver/webdriver_automation.cc

Issue 8943001: Fix mac chromedriver tests (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: ... Created 9 years 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
« no previous file with comments | « chrome/test/webdriver/test/run_chromedriver_tests.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/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 16 matching lines...) Expand all
27 #include "chrome/common/automation_constants.h" 27 #include "chrome/common/automation_constants.h"
28 #include "chrome/common/chrome_constants.h" 28 #include "chrome/common/chrome_constants.h"
29 #include "chrome/common/chrome_switches.h" 29 #include "chrome/common/chrome_switches.h"
30 #include "chrome/common/url_constants.h" 30 #include "chrome/common/url_constants.h"
31 #include "chrome/test/automation/automation_json_requests.h" 31 #include "chrome/test/automation/automation_json_requests.h"
32 #include "chrome/test/automation/automation_proxy.h" 32 #include "chrome/test/automation/automation_proxy.h"
33 #include "chrome/test/automation/browser_proxy.h" 33 #include "chrome/test/automation/browser_proxy.h"
34 #include "chrome/test/automation/extension_proxy.h" 34 #include "chrome/test/automation/extension_proxy.h"
35 #include "chrome/test/automation/proxy_launcher.h" 35 #include "chrome/test/automation/proxy_launcher.h"
36 #include "chrome/test/automation/tab_proxy.h" 36 #include "chrome/test/automation/tab_proxy.h"
37 #include "chrome/test/base/chrome_process_util.h"
37 #include "chrome/test/webdriver/frame_path.h" 38 #include "chrome/test/webdriver/frame_path.h"
38 #include "chrome/test/webdriver/webdriver_basic_types.h" 39 #include "chrome/test/webdriver/webdriver_basic_types.h"
39 #include "chrome/test/webdriver/webdriver_error.h" 40 #include "chrome/test/webdriver/webdriver_error.h"
40 #include "chrome/test/webdriver/webdriver_util.h" 41 #include "chrome/test/webdriver/webdriver_util.h"
41 42
42 #if defined(OS_WIN) 43 #if defined(OS_WIN)
43 #include "base/win/registry.h" 44 #include "base/win/registry.h"
44 #include "base/win/windows_version.h" 45 #include "base/win/windows_version.h"
45 #endif 46 #endif
46 47
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 *error = new Error( 296 *error = new Error(
296 kUnknownError, 297 kUnknownError,
297 "ChromeDriver is not compatible with this version of Chrome. " + 298 "ChromeDriver is not compatible with this version of Chrome. " +
298 chrome_details); 299 chrome_details);
299 return; 300 return;
300 } 301 }
301 } 302 }
302 303
303 void Automation::Terminate() { 304 void Automation::Terminate() {
304 if (launcher_.get() && launcher_->process() != base::kNullProcessHandle) { 305 if (launcher_.get() && launcher_->process() != base::kNullProcessHandle) {
305 launcher_->QuitBrowser(); 306 #if defined(OS_MACOSX)
307 // There's currently no way to shutdown gracefully with mac chrome.
308 // An alert could be open or (open before shutdown is started) and stop
309 // the whole process. Close any current dialog, try to kill gently, and
310 // if all else fails, kill it hard.
311 Error* error = NULL;
312 AcceptOrDismissAppModalDialog(true /* accept */, &error);
313 scoped_ptr<Error> scoped_error(error);
314
315 kill(launcher_->process(), SIGTERM);
316 int exit_code = -1;
317 if (!launcher_->WaitForBrowserProcessToQuit(10000, &exit_code)) {
318 TerminateAllChromeProcesses(launcher_->process_id());
319 }
320 base::CloseProcessHandle(launcher_->process());
321 #else
322 launcher_->TerminateBrowser();
323 #endif
306 } 324 }
307 } 325 }
308 326
309 void Automation::ExecuteScript(const WebViewId& view_id, 327 void Automation::ExecuteScript(const WebViewId& view_id,
310 const FramePath& frame_path, 328 const FramePath& frame_path,
311 const std::string& script, 329 const std::string& script,
312 std::string* result, 330 std::string* result,
313 Error** error) { 331 Error** error) {
314 WebViewLocator view_locator; 332 WebViewLocator view_locator;
315 *error = ConvertViewIdToLocator(view_id, &view_locator); 333 *error = ConvertViewIdToLocator(view_id, &view_locator);
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 return CheckVersion(750, 0, message); 947 return CheckVersion(750, 0, message);
930 } 948 }
931 949
932 Error* Automation::CheckNewExtensionInterfaceSupported() { 950 Error* Automation::CheckNewExtensionInterfaceSupported() {
933 const char* message = 951 const char* message =
934 "Extension interface is not supported for this version of Chrome"; 952 "Extension interface is not supported for this version of Chrome";
935 return CheckVersion(947, 0, message); 953 return CheckVersion(947, 0, message);
936 } 954 }
937 955
938 } // namespace webdriver 956 } // namespace webdriver
OLDNEW
« no previous file with comments | « chrome/test/webdriver/test/run_chromedriver_tests.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698