Chromium Code Reviews
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 #
Dependent Patchsets: Messages
Total messages: 10 (4 generated)
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||