| 31 | } |
| 32 | |
| 33 | void ActionsCommandHandler::ExecuteInternal( |
| 34 | const IECommandExecutor& executor, |
| 35 | const ParametersMap& command_parameters, |
| 36 | Response* response) { |
| 37 | BrowserHandle browser_wrapper; |
| 38 | int status_code = executor.GetCurrentBrowser(&browser_wrapper); |
| 39 | if (status_code != WD_SUCCESS) { |
| 40 | response->SetErrorResponse(status_code, "Unable to get current browser"); |
| 41 | return; |
| 42 | } |
| 43 | ParametersMap::const_iterator actions_parameter_iterator = command_parameters.find("actions"); |
| 44 | if (actions_parameter_iterator == command_parameters.end()) { |
| 45 | response->SetErrorResponse(ERROR_INVALID_ARGUMENT, "Missing parameter: actions"); |
| 46 | return; |
| 47 | } |
| 48 | if (!actions_parameter_iterator->second.isArray()) { |
| 49 | response->SetErrorResponse(ERROR_INVALID_ARGUMENT, "Actions value is not an array"); |
| 50 | return; |
| 51 | } |
| 52 | std::string error_info = ""; |
| 53 | status_code = executor.input_manager()->PerformInputSequence(browser_wrapper, |
| 54 | actions_parameter_iterator->second, |
| 55 | &error_info); |
| 56 | if (status_code != WD_SUCCESS) { |
| 57 | if (status_code == EMOVETARGETOUTOFBOUNDS) { |
| 58 | response->SetErrorResponse(status_code, error_info); |
| 59 | } else { |
| 60 | response->SetErrorResponse(status_code, "Unexpected error performing action sequence."); |
| 61 | } |
| 62 | return; |
| 63 | } |
| 64 | response->SetSuccessResponse(Json::Value::null); |
| 65 | } |
| 66 | |
| 67 | } // namespace webdriver |
nothing calls this directly
no test coverage detected