OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 25 matching lines...) Expand all Loading... |
36 if (!data_.GetInteger(kStatusKey, &status)) | 36 if (!data_.GetInteger(kStatusKey, &status)) |
37 NOTREACHED(); | 37 NOTREACHED(); |
38 return static_cast<ErrorCode>(status); | 38 return static_cast<ErrorCode>(status); |
39 } | 39 } |
40 | 40 |
41 void Response::SetStatus(ErrorCode status) { | 41 void Response::SetStatus(ErrorCode status) { |
42 data_.SetInteger(kStatusKey, status); | 42 data_.SetInteger(kStatusKey, status); |
43 } | 43 } |
44 | 44 |
45 const Value* Response::GetValue() const { | 45 const Value* Response::GetValue() const { |
46 Value* out = NULL; | 46 const Value* out = NULL; |
47 data_.Get(kValueKey, &out); | 47 data_.Get(kValueKey, &out); |
48 return out; | 48 return out; |
49 } | 49 } |
50 | 50 |
51 void Response::SetValue(Value* value) { | 51 void Response::SetValue(Value* value) { |
52 data_.Set(kValueKey, value); | 52 data_.Set(kValueKey, value); |
53 } | 53 } |
54 | 54 |
55 void Response::SetError(Error* error) { | 55 void Response::SetError(Error* error) { |
56 DictionaryValue* error_dict = new DictionaryValue(); | 56 DictionaryValue* error_dict = new DictionaryValue(); |
(...skipping 17 matching lines...) Expand all Loading... |
74 // The |Value| classes do not support int64 and in rare cases we need to | 74 // The |Value| classes do not support int64 and in rare cases we need to |
75 // return one. We do this by using a double and passing in the special | 75 // return one. We do this by using a double and passing in the special |
76 // option so that the JSONWriter doesn't add '.0' to the end and confuse | 76 // option so that the JSONWriter doesn't add '.0' to the end and confuse |
77 // the WebDriver client. | 77 // the WebDriver client. |
78 base::JSONWriter::WriteWithOptions( | 78 base::JSONWriter::WriteWithOptions( |
79 &data_, base::JSONWriter::OPTIONS_OMIT_DOUBLE_TYPE_PRESERVATION, &json); | 79 &data_, base::JSONWriter::OPTIONS_OMIT_DOUBLE_TYPE_PRESERVATION, &json); |
80 return json; | 80 return json; |
81 } | 81 } |
82 | 82 |
83 } // namespace webdriver | 83 } // namespace webdriver |
OLD | NEW |