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

Issue 1943783002: [NTP Snippets] Add unit tests for NTPSnippetsFetcher (Closed)

Created:
4 years, 7 months ago by mastiz
Modified:
4 years, 7 months ago
Reviewers:
Marc Treib
CC:
chromium-reviews, mcwilliams+watch_chromium.org, dgn+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[NTP Snippets] Add unit tests for NTPSnippetsFetcher Second attempt after https://codereview.chromium.org/1940843002/ was reverted in https://codereview.chromium.org/1940843002/ The class had almost no coverage given that, besides not having unit tests, the ones for NTPSnippetsService don't actually exercise the fetcher. The proposed tests make use of FakeURLFetcherFactory to exercise basic success and failure cases and verify how callbacks are triggered. FakeURLFetcherFactory doesn't however support verifying features like the uploaded POST data for selected hosts which is left outside the scope of this patch. A custom fetcher factory (FailingFakeURLFetcherFactory) is introduced to handle cases where no baked in response exists, which otherwise leads to null pointers returned by URLFetcher::Create() and later dereferenced. BUG=584428, 608443 Committed: https://crrev.com/7bef8e81ca49e36e1f90dc50aa84a45a465eb3f6 Cr-Commit-Position: refs/heads/master@{#391212}

Patch Set 1 #

Patch Set 2 : Introduce FailingFakeURLFetcherFactory to avoid null pointers. #

Total comments: 6

Patch Set 3 : Addressed minor comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+169 lines, -1 line) Patch
M components/components_tests.gyp View 1 chunk +1 line, -0 lines 0 comments Download
M components/ntp_snippets/BUILD.gn View 1 chunk +1 line, -0 lines 0 comments Download
M components/ntp_snippets/ntp_snippets_fetcher.h View 1 chunk +4 lines, -0 lines 0 comments Download
M components/ntp_snippets/ntp_snippets_fetcher.cc View 2 1 chunk +0 lines, -1 line 0 comments Download
A components/ntp_snippets/ntp_snippets_fetcher_unittest.cc View 1 2 1 chunk +163 lines, -0 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 10 (4 generated)
mastiz
4 years, 7 months ago (2016-05-03 10:08:16 UTC) #2
Marc Treib
LGTM with some comments below https://codereview.chromium.org/1943783002/diff/20001/components/ntp_snippets/ntp_snippets_fetcher.cc File components/ntp_snippets/ntp_snippets_fetcher.cc (right): https://codereview.chromium.org/1943783002/diff/20001/components/ntp_snippets/ntp_snippets_fetcher.cc#newcode95 components/ntp_snippets/ntp_snippets_fetcher.cc:95: CHECK(url_fetcher_ != nullptr); DCHECK ...
4 years, 7 months ago (2016-05-03 11:33:42 UTC) #3
mastiz
https://codereview.chromium.org/1943783002/diff/20001/components/ntp_snippets/ntp_snippets_fetcher.cc File components/ntp_snippets/ntp_snippets_fetcher.cc (right): https://codereview.chromium.org/1943783002/diff/20001/components/ntp_snippets/ntp_snippets_fetcher.cc#newcode95 components/ntp_snippets/ntp_snippets_fetcher.cc:95: CHECK(url_fetcher_ != nullptr); On 2016/05/03 11:33:42, Marc Treib wrote: ...
4 years, 7 months ago (2016-05-03 11:48:57 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1943783002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1943783002/40001
4 years, 7 months ago (2016-05-03 11:52:40 UTC) #7
commit-bot: I haz the power
Committed patchset #3 (id:40001)
4 years, 7 months ago (2016-05-03 12:52:58 UTC) #8
commit-bot: I haz the power
4 years, 7 months ago (2016-05-03 12:54:35 UTC) #10
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/7bef8e81ca49e36e1f90dc50aa84a45a465eb3f6
Cr-Commit-Position: refs/heads/master@{#391212}

Powered by Google App Engine
This is Rietveld 408576698