Commit d1869577 authored by Vitalii Iarko's avatar Vitalii Iarko Committed by Commit Bot

[NTP::Push] Do not use DCHECKs for server provided data.

As treib@ pointed out, my usage of DCHECKs to check our assumptions
about server provided data was inappropriate. This CL replaces DCHECKs
with LOG(WARNING) and then return.

Bug: 
Change-Id: I905cf99079f5075c633b4aa3d7e85381f552f3e2
Reviewed-on: https://chromium-review.googlesource.com/597855
Commit-Queue: vitaliii <vitaliii@chromium.org>
Reviewed-by: default avatarChris Pickel <sfiera@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491381}
parent 9988a1bb
...@@ -170,11 +170,23 @@ void BreakingNewsGCMAppHandler::OnJsonSuccess( ...@@ -170,11 +170,23 @@ void BreakingNewsGCMAppHandler::OnJsonSuccess(
/*fetch_time=*/base::Time::Now())) { /*fetch_time=*/base::Time::Now())) {
std::string content_json; std::string content_json;
base::JSONWriter::Write(*content, &content_json); base::JSONWriter::Write(*content, &content_json);
LOG(WARNING) << "Received invalid breaking news: " << content_json; LOG(WARNING)
<< "Received invalid breaking news: can't interpret value, json is "
<< content_json;
return;
}
if (fetched_categories.size() != 1) {
LOG(WARNING)
<< "Received invalid breaking news: expected 1 category, but got "
<< fetched_categories.size();
return;
}
if (fetched_categories[0].suggestions.size() != 1) {
LOG(WARNING)
<< "Received invalid breaking news: expected 1 suggestion, but got "
<< fetched_categories[0].suggestions.size();
return; return;
} }
DCHECK_EQ(1u, fetched_categories.size());
DCHECK_EQ(1u, fetched_categories[0].suggestions.size());
on_new_remote_suggestion_callback_.Run( on_new_remote_suggestion_callback_.Run(
std::move(fetched_categories[0].suggestions[0])); std::move(fetched_categories[0].suggestions[0]));
......
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