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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 void Automation::ExecuteScript(const WebViewId& view_id, | 537 void Automation::ExecuteScript(const WebViewId& view_id, |
538 const FramePath& frame_path, | 538 const FramePath& frame_path, |
539 const std::string& script, | 539 const std::string& script, |
540 std::string* result, | 540 std::string* result, |
541 Error** error) { | 541 Error** error) { |
542 WebViewLocator view_locator; | 542 WebViewLocator view_locator; |
543 *error = ConvertViewIdToLocator(view_id, &view_locator); | 543 *error = ConvertViewIdToLocator(view_id, &view_locator); |
544 if (*error) | 544 if (*error) |
545 return; | 545 return; |
546 | 546 |
547 Value* unscoped_value; | |
548 automation::Error auto_error; | 547 automation::Error auto_error; |
| 548 scoped_ptr<Value> value; |
549 if (!SendExecuteJavascriptJSONRequest(automation(), view_locator, | 549 if (!SendExecuteJavascriptJSONRequest(automation(), view_locator, |
550 frame_path.value(), script, | 550 frame_path.value(), script, |
551 &unscoped_value, &auto_error)) { | 551 &value, &auto_error)) { |
552 *error = Error::FromAutomationError(auto_error); | 552 *error = Error::FromAutomationError(auto_error); |
553 return; | 553 return; |
554 } | 554 } |
555 scoped_ptr<Value> value(unscoped_value); | |
556 if (!value->GetAsString(result)) | 555 if (!value->GetAsString(result)) |
557 *error = new Error(kUnknownError, "Execute script did not return string"); | 556 *error = new Error(kUnknownError, "Execute script did not return string"); |
558 } | 557 } |
559 | 558 |
560 void Automation::MouseMoveDeprecated( | 559 void Automation::MouseMoveDeprecated( |
561 const WebViewId& view_id, | 560 const WebViewId& view_id, |
562 const Point& p, | 561 const Point& p, |
563 Error** error) { | 562 Error** error) { |
564 WebViewLocator view_locator; | 563 WebViewLocator view_locator; |
565 *error = ConvertViewIdToLocator(view_id, &view_locator); | 564 *error = ConvertViewIdToLocator(view_id, &view_locator); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 *error = ConvertViewIdToLocator(view_id, &view_locator); | 836 *error = ConvertViewIdToLocator(view_id, &view_locator); |
838 if (*error) | 837 if (*error) |
839 return; | 838 return; |
840 | 839 |
841 automation::Error auto_error; | 840 automation::Error auto_error; |
842 if (!SendReloadJSONRequest(automation(), view_locator, &auto_error)) | 841 if (!SendReloadJSONRequest(automation(), view_locator, &auto_error)) |
843 *error = Error::FromAutomationError(auto_error); | 842 *error = Error::FromAutomationError(auto_error); |
844 } | 843 } |
845 | 844 |
846 void Automation::GetCookies(const std::string& url, | 845 void Automation::GetCookies(const std::string& url, |
847 ListValue** cookies, | 846 scoped_ptr<ListValue>* cookies, |
848 Error** error) { | 847 Error** error) { |
849 automation::Error auto_error; | 848 automation::Error auto_error; |
850 if (!SendGetCookiesJSONRequest(automation(), url, cookies, &auto_error)) | 849 if (!SendGetCookiesJSONRequest(automation(), url, cookies, &auto_error)) |
851 *error = Error::FromAutomationError(auto_error); | 850 *error = Error::FromAutomationError(auto_error); |
852 } | 851 } |
853 | 852 |
854 void Automation::DeleteCookie(const std::string& url, | 853 void Automation::DeleteCookie(const std::string& url, |
855 const std::string& cookie_name, | 854 const std::string& cookie_name, |
856 Error** error) { | 855 Error** error) { |
857 automation::Error auto_error; | 856 automation::Error auto_error; |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1207 } | 1206 } |
1208 | 1207 |
1209 Error* Automation::CheckMaximizeSupported() { | 1208 Error* Automation::CheckMaximizeSupported() { |
1210 const char* message = | 1209 const char* message = |
1211 "Maximize automation interface is not supported for this version of " | 1210 "Maximize automation interface is not supported for this version of " |
1212 "Chrome."; | 1211 "Chrome."; |
1213 return CheckVersion(1160, message); | 1212 return CheckVersion(1160, message); |
1214 } | 1213 } |
1215 | 1214 |
1216 } // namespace webdriver | 1215 } // namespace webdriver |
OLD | NEW |