OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/webdriver/commands/response.h" | 5 #include "chrome/test/webdriver/commands/response.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 int status; | 39 int status; |
40 if (!data_.GetInteger(kStatusKey, &status)) | 40 if (!data_.GetInteger(kStatusKey, &status)) |
41 NOTREACHED(); | 41 NOTREACHED(); |
42 return static_cast<ErrorCode>(status); | 42 return static_cast<ErrorCode>(status); |
43 } | 43 } |
44 | 44 |
45 void Response::SetStatus(ErrorCode status) { | 45 void Response::SetStatus(ErrorCode status) { |
46 data_.SetInteger(kStatusKey, status); | 46 data_.SetInteger(kStatusKey, status); |
47 } | 47 } |
48 | 48 |
49 Value* Response::GetValue() const { | 49 const Value* Response::GetValue() const { |
50 Value* out = NULL; | 50 Value* out = NULL; |
51 LOG_IF(WARNING, !data_.Get(kValueKey, &out)) | 51 LOG_IF(WARNING, !data_.Get(kValueKey, &out)) |
52 << "Accessing unset response value."; // Should never happen. | 52 << "Accessing unset response value."; // Should never happen. |
53 return out; | 53 return out; |
54 } | 54 } |
55 | 55 |
56 void Response::SetValue(Value* value) { | 56 void Response::SetValue(Value* value) { |
57 data_.Set(kValueKey, value); | 57 data_.Set(kValueKey, value); |
58 } | 58 } |
59 | 59 |
(...skipping 10 matching lines...) Expand all Loading... |
70 data_.Set(key, value); | 70 data_.Set(key, value); |
71 } | 71 } |
72 | 72 |
73 std::string Response::ToJSON() const { | 73 std::string Response::ToJSON() const { |
74 std::string json; | 74 std::string json; |
75 base::JSONWriter::Write(&data_, false, &json); | 75 base::JSONWriter::Write(&data_, false, &json); |
76 return json; | 76 return json; |
77 } | 77 } |
78 | 78 |
79 } // namespace webdriver | 79 } // namespace webdriver |
OLD | NEW |