Commit 7f37257a authored by Nigel Tao's avatar Nigel Tao Committed by Commit Bot

Fix file_net_log_observer_unittest use of JSONReader

JSONReader::Read is a static method, but JSONReader::GetErrorMessage is
not. If invaild JSON is passed, GetErrorMessage() will not return
anything useful.

Bug: 1070409
Change-Id: If45ff0d665964f7b02be26a7b1af436918cbb1fb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2227944Reviewed-by: default avatarEric Roman <eroman@chromium.org>
Commit-Queue: Nigel Tao <nigeltao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#775053}
parent e5d46d14
......@@ -123,12 +123,12 @@ struct ParsedNetLog {
return ::testing::AssertionFailure() << "input is empty";
}
base::JSONReader reader;
base::Optional<base::Value> container_optional = reader.Read(input);
if (!container_optional) {
return ::testing::AssertionFailure() << reader.GetErrorMessage();
base::JSONReader::ValueWithError parsed_json =
base::JSONReader::ReadAndReturnValueWithError(input);
if (!parsed_json.value) {
return ::testing::AssertionFailure() << parsed_json.error_message;
}
container = std::move(*container_optional);
container = std::move(*parsed_json.value);
if (!container.GetAsDictionary(&root)) {
return ::testing::AssertionFailure() << "Not a dictionary";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment