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

Issue 2285133004: Overhaul ntp_snippets_service_unittest.cc. (Closed)

Created:
4 years, 3 months ago by sfiera
Modified:
4 years, 3 months ago
Reviewers:
Marc Treib, tschumann
CC:
chromium-reviews, ntp-dev+reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Overhaul ntp_snippets_service_unittest.cc. A partial list of things done here: * Move tests that verified NTPSnippet::best_source() behavior into ntp_snippet_test.cc; they don't belong here. * Switch it to use the chromecontentsuggestions-pa. Testing new features like server-provided categories is not possible without this. * Replace MockContentSuggestionsProviderObserver with a fake. It shouldn't have been a mock, since we weren't using it to test behavior, only state. * In one case, test using what the observer sees, instead of peeking in through debugging hooks. * Get rid of special test base class and Mock::VerifyAndClear calls; I consider these anti-patterns. * Initialize the service better; give it an empty list of snippets for its first fetch, and wait for it to complete the fetch before returning (I think this is what was most strongly implicated by the failures with the other CL). * Create the service and expect the scheduling directly from each case, so they are more readable individually. Committed: https://crrev.com/e88d16809c5f7a0d5e8d59caa451dc4359fa7b06 Cr-Commit-Position: refs/heads/master@{#415358}

Patch Set 1 #

Total comments: 66

Patch Set 2 : Address review comments. #

Patch Set 3 : Fix histogram test. #

Patch Set 4 : merge #

Total comments: 6

Patch Set 5 : Address review comments. #

Patch Set 6 : No brackets. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+663 lines, -562 lines) Patch
M components/ntp_snippets/ntp_snippet_unittest.cc View 1 3 chunks +221 lines, -5 lines 0 comments Download
M components/ntp_snippets/ntp_snippets_service_unittest.cc View 1 2 3 4 5 18 chunks +401 lines, -511 lines 0 comments Download
M components/ntp_snippets/ntp_snippets_status_service_unittest.cc View 1 chunk +19 lines, -19 lines 0 comments Download
M components/ntp_snippets/ntp_snippets_test_utils.h View 3 chunks +10 lines, -12 lines 0 comments Download
M components/ntp_snippets/ntp_snippets_test_utils.cc View 2 chunks +12 lines, -15 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 31 (18 generated)
sfiera
With this, I'll be able to write proper tests for the other CL, instead of ...
4 years, 3 months ago (2016-08-29 18:33:19 UTC) #2
tschumann
i like the overall change a lot. I left some comments, not sure about our ...
4 years, 3 months ago (2016-08-30 06:57:21 UTC) #4
Marc Treib
Very nice! Bunch of comments below, but nothing major. https://codereview.chromium.org/2285133004/diff/1/components/ntp_snippets/ntp_snippet_unittest.cc File components/ntp_snippets/ntp_snippet_unittest.cc (right): https://codereview.chromium.org/2285133004/diff/1/components/ntp_snippets/ntp_snippet_unittest.cc#newcode19 components/ntp_snippets/ntp_snippet_unittest.cc:19: ...
4 years, 3 months ago (2016-08-30 09:29:29 UTC) #5
sfiera
https://codereview.chromium.org/2285133004/diff/1/components/ntp_snippets/ntp_snippet_unittest.cc File components/ntp_snippets/ntp_snippet_unittest.cc (right): https://codereview.chromium.org/2285133004/diff/1/components/ntp_snippets/ntp_snippet_unittest.cc#newcode19 components/ntp_snippets/ntp_snippet_unittest.cc:19: if (!json_value->GetAsDictionary(&json_dict)) { On 2016/08/30 09:29:28, Marc Treib wrote: ...
4 years, 3 months ago (2016-08-30 13:16:44 UTC) #9
Marc Treib
LGTM with a few more nits/suggestions https://codereview.chromium.org/2285133004/diff/1/components/ntp_snippets/ntp_snippet_unittest.cc File components/ntp_snippets/ntp_snippet_unittest.cc (right): https://codereview.chromium.org/2285133004/diff/1/components/ntp_snippets/ntp_snippet_unittest.cc#newcode103 components/ntp_snippets/ntp_snippet_unittest.cc:103: // Expect the ...
4 years, 3 months ago (2016-08-30 13:43:39 UTC) #16
tschumann
lgtm https://codereview.chromium.org/2285133004/diff/1/components/ntp_snippets/ntp_snippet_unittest.cc File components/ntp_snippets/ntp_snippet_unittest.cc (right): https://codereview.chromium.org/2285133004/diff/1/components/ntp_snippets/ntp_snippet_unittest.cc#newcode19 components/ntp_snippets/ntp_snippet_unittest.cc:19: if (!json_value->GetAsDictionary(&json_dict)) { On 2016/08/30 13:16:43, sfiera wrote: ...
4 years, 3 months ago (2016-08-30 14:01:39 UTC) #17
tschumann
lgtm
4 years, 3 months ago (2016-08-30 14:01:41 UTC) #18
Marc Treib
https://codereview.chromium.org/2285133004/diff/1/components/ntp_snippets/ntp_snippets_service_unittest.cc File components/ntp_snippets/ntp_snippets_service_unittest.cc (right): https://codereview.chromium.org/2285133004/diff/1/components/ntp_snippets/ntp_snippets_service_unittest.cc#newcode472 components/ntp_snippets/ntp_snippets_service_unittest.cc:472: // EXPECT_EQ(GURL(kSnippetSalientImage), snippet.salient_image_url()); On 2016/08/30 14:01:39, tschumann wrote: > ...
4 years, 3 months ago (2016-08-30 14:04:39 UTC) #19
sfiera
Two outstanding action items which will I'll handle separately: * Remove image from ContentSuggestion * ...
4 years, 3 months ago (2016-08-30 16:33:09 UTC) #20
Marc Treib
LGTM++, thanks!
4 years, 3 months ago (2016-08-30 16:46:58 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2285133004/110001
4 years, 3 months ago (2016-08-30 17:28:11 UTC) #28
commit-bot: I haz the power
Committed patchset #6 (id:110001)
4 years, 3 months ago (2016-08-30 18:16:43 UTC) #29
commit-bot: I haz the power
4 years, 3 months ago (2016-08-30 18:19:11 UTC) #31
Message was sent while issue was closed.
Patchset 6 (id:??) landed as
https://crrev.com/e88d16809c5f7a0d5e8d59caa451dc4359fa7b06
Cr-Commit-Position: refs/heads/master@{#415358}

Powered by Google App Engine
This is Rietveld 408576698