| 120 | } |
| 121 | |
| 122 | int Response::GetHttpResponseCode(void) { |
| 123 | int response_code = 200; |
| 124 | if (this->error_ == ERROR_ELEMENT_CLICK_INTERCEPTED || |
| 125 | this->error_ == ERROR_ELEMENT_NOT_SELECTABLE || |
| 126 | this->error_ == ERROR_ELEMENT_NOT_INTERACTABLE || |
| 127 | this->error_ == ERROR_INSECURE_CERTIFICATE || |
| 128 | this->error_ == ERROR_INVALID_ARGUMENT || |
| 129 | this->error_ == ERROR_INVALID_COOKIE_DOMAIN || |
| 130 | this->error_ == ERROR_INVALID_COORDINATES || |
| 131 | this->error_ == ERROR_INVALID_ELEMENT_STATE || |
| 132 | this->error_ == ERROR_INVALID_SELECTOR) { |
| 133 | response_code = 400; |
| 134 | } else if (this->error_ == ERROR_INVALID_SESSION_ID || |
| 135 | this->error_ == ERROR_NO_SUCH_COOKIE || |
| 136 | this->error_ == ERROR_NO_SUCH_ALERT || |
| 137 | this->error_ == ERROR_NO_SUCH_ELEMENT || |
| 138 | this->error_ == ERROR_NO_SUCH_FRAME || |
| 139 | this->error_ == ERROR_NO_SUCH_WINDOW || |
| 140 | this->error_ == ERROR_STALE_ELEMENT_REFERENCE || |
| 141 | this->error_ == ERROR_UNKNOWN_COMMAND) { |
| 142 | response_code = 404; |
| 143 | } else if (this->error_ == ERROR_UNKNOWN_METHOD) { |
| 144 | response_code = 405; |
| 145 | } else if (this->error_ == ERROR_JAVASCRIPT_ERROR || |
| 146 | this->error_ == ERROR_MOVE_TARGET_OUT_OF_BOUNDS || |
| 147 | this->error_ == ERROR_SCRIPT_TIMEOUT || |
| 148 | this->error_ == ERROR_SESSION_NOT_CREATED || |
| 149 | this->error_ == ERROR_UNABLE_TO_SET_COOKIE || |
| 150 | this->error_ == ERROR_UNABLE_TO_CAPTURE_SCREEN || |
| 151 | this->error_ == ERROR_UNEXPECTED_ALERT_OPEN || |
| 152 | this->error_ == ERROR_UNKNOWN_ERROR || |
| 153 | this->error_ == ERROR_UNSUPPORTED_OPERATION || |
| 154 | this->error_ == ERROR_WEBDRIVER_TIMEOUT) { |
| 155 | response_code = 500; |
| 156 | } else { |
| 157 | response_code = 200; |
| 158 | } |
| 159 | |
| 160 | return response_code; |
| 161 | } |
| 162 | |
| 163 | std::string Response::ConvertErrorCode(const int error_code) { |
| 164 | if (error_code == WD_SUCCESS) { |
no outgoing calls
no test coverage detected