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

Issue 11567027: Add a base::ParseJson() function to help tests construct Values. (Closed)

Created:
8 years ago by Jeffrey Yasskin
Modified:
8 years ago
CC:
chromium-reviews, jam, joi+watch-content_chromium.org, Aaron Boodman, darin-cc_chromium.org, chromium-apps-reviews_chromium.org, erikwright+watch_chromium.org
Visibility:
Public.

Description

Add a base::ParseJson() function to help tests construct Values. This is very similar to base::JSONReader::Read() except that it allows trailing commas and EXPECT-fails with a good message when the json is malformed. I migrated two tests to use this as a demonstration that it's widely useful and makes things more readable. Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=173540

Patch Set 1 #

Total comments: 5

Patch Set 2 : Move ParseJson into base::test #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+138 lines, -129 lines) Patch
M base/test/values_test_util.h View 1 2 chunks +12 lines, -0 lines 0 comments Download
M base/test/values_test_util.cc View 1 2 chunks +18 lines, -1 line 0 comments Download
M chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_unittest.cc View 1 5 chunks +61 lines, -76 lines 0 comments Download
M content/renderer/v8_value_converter_impl_unittest.cc View 1 7 chunks +47 lines, -52 lines 4 comments Download

Messages

Total messages: 14 (0 generated)
Jeffrey Yasskin
Dominic and James, feel free to tell me to find other example files. https://codereview.chromium.org/11567027/diff/1/base/test/values_test_util.cc File ...
8 years ago (2012-12-13 23:20:29 UTC) #1
jamesr
On 2012/12/13 23:20:29, Jeffrey Yasskin wrote: > Dominic and James, feel free to tell me ...
8 years ago (2012-12-13 23:23:32 UTC) #2
jamesr
https://codereview.chromium.org/11567027/diff/1/base/test/values_test_util.h File base/test/values_test_util.h (right): https://codereview.chromium.org/11567027/diff/1/base/test/values_test_util.h#newcode46 base/test/values_test_util.h:46: // Parses |json| as JSON, allowing trailing commas, and ...
8 years ago (2012-12-13 23:24:41 UTC) #3
Jeffrey Yasskin
https://codereview.chromium.org/11567027/diff/1/base/test/values_test_util.h File base/test/values_test_util.h (right): https://codereview.chromium.org/11567027/diff/1/base/test/values_test_util.h#newcode46 base/test/values_test_util.h:46: // Parses |json| as JSON, allowing trailing commas, and ...
8 years ago (2012-12-13 23:29:27 UTC) #4
jamesr
On Thu, Dec 13, 2012 at 3:29 PM, <jyasskin@chromium.org> wrote: > > https://codereview.chromium.**org/11567027/diff/1/base/test/** > values_test_util.h<https://codereview.chromium.org/11567027/diff/1/base/test/values_test_util.h> ...
8 years ago (2012-12-13 23:31:37 UTC) #5
willchan no longer on Chromium
lgtm, mod this naming concern. https://chromiumcodereview.appspot.com/11567027/diff/1/base/test/values_test_util.cc File base/test/values_test_util.cc (right): https://chromiumcodereview.appspot.com/11567027/diff/1/base/test/values_test_util.cc#newcode63 base/test/values_test_util.cc:63: scoped_ptr<Value> ParseJson(base::StringPiece json) { ...
8 years ago (2012-12-14 20:35:04 UTC) #6
Jeffrey Yasskin
https://chromiumcodereview.appspot.com/11567027/diff/1/base/test/values_test_util.cc File base/test/values_test_util.cc (right): https://chromiumcodereview.appspot.com/11567027/diff/1/base/test/values_test_util.cc#newcode63 base/test/values_test_util.cc:63: scoped_ptr<Value> ParseJson(base::StringPiece json) { On 2012/12/14 20:35:04, willchan wrote: ...
8 years ago (2012-12-14 23:12:41 UTC) #7
battre
LGTM if the two comments don't need to be addressed. https://chromiumcodereview.appspot.com/11567027/diff/9001/content/renderer/v8_value_converter_impl_unittest.cc File content/renderer/v8_value_converter_impl_unittest.cc (right): https://chromiumcodereview.appspot.com/11567027/diff/9001/content/renderer/v8_value_converter_impl_unittest.cc#newcode537 ...
8 years ago (2012-12-17 09:36:48 UTC) #8
Jeffrey Yasskin
Thanks for the reviews. :) https://chromiumcodereview.appspot.com/11567027/diff/9001/content/renderer/v8_value_converter_impl_unittest.cc File content/renderer/v8_value_converter_impl_unittest.cc (right): https://chromiumcodereview.appspot.com/11567027/diff/9001/content/renderer/v8_value_converter_impl_unittest.cc#newcode537 content/renderer/v8_value_converter_impl_unittest.cc:537: EXPECT_TRUE(Value::Equals(base::test::ParseJson("{ \"bar\": null }").get(), ...
8 years ago (2012-12-17 18:09:27 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jyasskin@chromium.org/11567027/9001
8 years ago (2012-12-17 18:09:45 UTC) #10
commit-bot: I haz the power
Presubmit check for 11567027-9001 failed and returned exit status 1. Running presubmit commit checks ...
8 years ago (2012-12-17 18:09:52 UTC) #11
jamesr
content/renderer lgtm
8 years ago (2012-12-17 18:21:51 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jyasskin@chromium.org/11567027/9001
8 years ago (2012-12-17 18:25:30 UTC) #13
commit-bot: I haz the power
8 years ago (2012-12-17 21:45:42 UTC) #14
Message was sent while issue was closed.
Change committed as 173540

Powered by Google App Engine
This is Rietveld 408576698