diff options
| author | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-19 23:32:55 +0000 |
|---|---|---|
| committer | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-19 23:32:55 +0000 |
| commit | b7448dc7eac020055d9bc9aee12d1b9ed7dbd466 (patch) | |
| tree | c2689890eff1a27bcb9c50167f015daa21b55f08 /chrome/test/webdriver/dispatch.cc | |
| parent | 86469503a695e2ede48244c846053dd9ae91e5fa (diff) | |
| download | chromium_src-b7448dc7eac020055d9bc9aee12d1b9ed7dbd466.zip chromium_src-b7448dc7eac020055d9bc9aee12d1b9ed7dbd466.tar.gz chromium_src-b7448dc7eac020055d9bc9aee12d1b9ed7dbd466.tar.bz2 | |
Cleaning up response.h and moving all of the logic into the .cc file.
Patch by jleyba@chromium.org.
Original review at http://codereview.chromium.org/6543015
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6469071
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75506 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/webdriver/dispatch.cc')
| -rw-r--r-- | chrome/test/webdriver/dispatch.cc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/chrome/test/webdriver/dispatch.cc b/chrome/test/webdriver/dispatch.cc index 28a94da..26b9738 100644 --- a/chrome/test/webdriver/dispatch.cc +++ b/chrome/test/webdriver/dispatch.cc @@ -54,7 +54,8 @@ namespace internal { void PrepareHttpResponse(const Response& command_response, HttpResponse* const http_response) { - switch (command_response.status()) { + ErrorCode status = command_response.GetStatus(); + switch (status) { case kSuccess: http_response->set_status(HttpResponse::kOk); break; @@ -63,7 +64,7 @@ void PrepareHttpResponse(const Response& command_response, // and kMethodNotAllowed should be detected before creating // a command_response, and should thus not need conversion. case kSeeOther: { - const Value* const value = command_response.value(); + const Value* const value = command_response.GetValue(); std::string location; if (!value->GetAsString(&location)) { // This should never happen. @@ -80,11 +81,11 @@ void PrepareHttpResponse(const Response& command_response, case kBadRequest: case kSessionNotFound: - http_response->set_status(command_response.status()); + http_response->set_status(status); break; case kMethodNotAllowed: { - const Value* const value = command_response.value(); + const Value* const value = command_response.GetValue(); if (!value->IsType(Value::TYPE_LIST)) { // This should never happen. http_response->set_status(HttpResponse::kInternalServerError); @@ -169,9 +170,9 @@ bool ParseRequestInfo(const struct mg_request_info* const request_info, std::string json(request_info->post_data, request_info->post_data_len); std::string error; if (!ParseJSONDictionary(json, parameters, &error)) { - response->set_value(Value::CreateStringValue( - "Failed to parse command data: " + error + "\n Data: " + json)); - response->set_status(kBadRequest); + SET_WEBDRIVER_ERROR(response, + "Failed to parse command data: " + error + "\n Data: " + json, + kBadRequest); return false; } } @@ -198,8 +199,8 @@ void DispatchHelper(Command* command_ptr, } if (command->DoesDelete()) methods->Append(Value::CreateStringValue("DELETE")); - response->set_status(kMethodNotAllowed); - response->set_value(methods); + response->SetStatus(kMethodNotAllowed); + response->SetValue(methods); return; } |
