Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1808)

Unified Diff: chrome/test/webdriver/commands/response.cc

Issue 9016024: Add option for not adding '.0' to the end of doubles that have no fractional (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/json/json_writer_unittest.cc ('k') | chrome/test/webdriver/webdriver_logging.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/webdriver/commands/response.cc
diff --git a/chrome/test/webdriver/commands/response.cc b/chrome/test/webdriver/commands/response.cc
index bef138635627ee1169c4913d9a936e179e09dc04..5fece6de14e4a42e6bd9824b27da759135c92e5c 100644
--- a/chrome/test/webdriver/commands/response.cc
+++ b/chrome/test/webdriver/commands/response.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -71,7 +71,13 @@ const Value* Response::GetDictionary() const {
std::string Response::ToJSON() const {
std::string json;
- base::JSONWriter::Write(&data_, false, &json);
+ // The |Value| classes do not support int64 and in rare cases we need to
+ // return one. We do this by using a double and passing in the special
+ // option so that the JSONWriter doesn't add '.0' to the end and confuse
+ // the WebDriver client.
+ base::JSONWriter::WriteWithOptions(
+ &data_, false,
+ base::JSONWriter::OPTIONS_OMIT_DOUBLE_TYPE_PRESERVATION, &json);
return json;
}
« no previous file with comments | « base/json/json_writer_unittest.cc ('k') | chrome/test/webdriver/webdriver_logging.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698