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

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, 12 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
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..41ea8d8190e9b8aa30ec6fb7887ee6c5e0c5c35e 100644
--- a/chrome/test/webdriver/commands/response.cc
+++ b/chrome/test/webdriver/commands/response.cc
@@ -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_ALLOW_DOUBLES_AS_INTEGERS, &json);
return json;
}

Powered by Google App Engine
This is Rietveld 408576698