| OLD | NEW |
| 1 // Copyright (c) 2011 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" |
| 11 | 11 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 void Response::SetField(const std::string& key, Value* value) { | 64 void Response::SetField(const std::string& key, Value* value) { |
| 65 data_.Set(key, value); | 65 data_.Set(key, value); |
| 66 } | 66 } |
| 67 | 67 |
| 68 const Value* Response::GetDictionary() const { | 68 const Value* Response::GetDictionary() const { |
| 69 return &data_; | 69 return &data_; |
| 70 } | 70 } |
| 71 | 71 |
| 72 std::string Response::ToJSON() const { | 72 std::string Response::ToJSON() const { |
| 73 std::string json; | 73 std::string json; |
| 74 base::JSONWriter::Write(&data_, false, &json); | 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 |
| 76 // option so that the JSONWriter doesn't add '.0' to the end and confuse |
| 77 // the WebDriver client. |
| 78 base::JSONWriter::WriteWithOptions( |
| 79 &data_, false, |
| 80 base::JSONWriter::OPTIONS_OMIT_DOUBLE_TYPE_PRESERVATION, &json); |
| 75 return json; | 81 return json; |
| 76 } | 82 } |
| 77 | 83 |
| 78 } // namespace webdriver | 84 } // namespace webdriver |
| OLD | NEW |