OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/chromedriver/window_commands.h" | 5 #include "chrome/test/chromedriver/window_commands.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <string> | 10 #include <string> |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 if (!params.GetInteger("x", &location.x)) | 708 if (!params.GetInteger("x", &location.x)) |
709 return Status(kUnknownError, "'x' must be an integer"); | 709 return Status(kUnknownError, "'x' must be an integer"); |
710 if (!params.GetInteger("y", &location.y)) | 710 if (!params.GetInteger("y", &location.y)) |
711 return Status(kUnknownError, "'y' must be an integer"); | 711 return Status(kUnknownError, "'y' must be an integer"); |
712 double scale_factor; | 712 double scale_factor; |
713 if (!params.GetDouble("scale", &scale_factor)) | 713 if (!params.GetDouble("scale", &scale_factor)) |
714 return Status(kUnknownError, "'scale' must be an integer"); | 714 return Status(kUnknownError, "'scale' must be an integer"); |
715 return web_view->SynthesizePinchGesture(location.x, location.y, scale_factor); | 715 return web_view->SynthesizePinchGesture(location.x, location.y, scale_factor); |
716 } | 716 } |
717 | 717 |
| 718 Status ExecuteSendCommand(Session* session, |
| 719 WebView* web_view, |
| 720 const base::DictionaryValue& params, |
| 721 std::unique_ptr<base::Value>* value, |
| 722 Timeout* timeout) { |
| 723 std::string cmd; |
| 724 if (!params.GetString("cmd", &cmd)) { |
| 725 return Status(kUnknownError, "command not passed"); |
| 726 } |
| 727 const base::DictionaryValue* cmdParams; |
| 728 if (!params.GetDictionary("params", &cmdParams)) { |
| 729 return Status(kUnknownError, "params not passed"); |
| 730 } |
| 731 return web_view->SendCommand(cmd, *cmdParams); |
| 732 } |
| 733 |
| 734 Status ExecuteSendCommandAndGetResult(Session* session, |
| 735 WebView* web_view, |
| 736 const base::DictionaryValue& params, |
| 737 std::unique_ptr<base::Value>* value, |
| 738 Timeout* timeout) { |
| 739 std::string cmd; |
| 740 if (!params.GetString("cmd", &cmd)) { |
| 741 return Status(kUnknownError, "command not passed"); |
| 742 } |
| 743 const base::DictionaryValue* cmdParams; |
| 744 if (!params.GetDictionary("params", &cmdParams)) { |
| 745 return Status(kUnknownError, "params not passed"); |
| 746 } |
| 747 return web_view->SendCommandAndGetResult(cmd, *cmdParams, value); |
| 748 } |
| 749 |
718 Status ExecuteGetActiveElement(Session* session, | 750 Status ExecuteGetActiveElement(Session* session, |
719 WebView* web_view, | 751 WebView* web_view, |
720 const base::DictionaryValue& params, | 752 const base::DictionaryValue& params, |
721 std::unique_ptr<base::Value>* value, | 753 std::unique_ptr<base::Value>* value, |
722 Timeout* timeout) { | 754 Timeout* timeout) { |
723 return GetActiveElement(session, web_view, value); | 755 return GetActiveElement(session, web_view, value); |
724 } | 756 } |
725 | 757 |
726 Status ExecuteSendKeysToActiveElement(Session* session, | 758 Status ExecuteSendKeysToActiveElement(Session* session, |
727 WebView* web_view, | 759 WebView* web_view, |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 return status; | 1110 return status; |
1079 } | 1111 } |
1080 | 1112 |
1081 Status ExecuteTakeHeapSnapshot(Session* session, | 1113 Status ExecuteTakeHeapSnapshot(Session* session, |
1082 WebView* web_view, | 1114 WebView* web_view, |
1083 const base::DictionaryValue& params, | 1115 const base::DictionaryValue& params, |
1084 std::unique_ptr<base::Value>* value, | 1116 std::unique_ptr<base::Value>* value, |
1085 Timeout* timeout) { | 1117 Timeout* timeout) { |
1086 return web_view->TakeHeapSnapshot(value); | 1118 return web_view->TakeHeapSnapshot(value); |
1087 } | 1119 } |
OLD | NEW |