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