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

Issue 2549163002: RemoteContentSuggestions: Stores the time of the last successful background fetch in a pref (Closed)

Created:
4 years ago by markusheintz_
Modified:
4 years ago
Reviewers:
Marc Treib, tschumann
CC:
chromium-reviews, ntp-dev+reviews_chromium.org, fhorschig, jkrcal
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

RemoteContentSuggestions: Stores the time of the last successful background fetch in a pref. Therefore we also need to pass the fetch success status to the callback passed to the NTPSnippetsFetcher. The last successful background fetch time will be used by the scheduler in the future in order to decide when to do/schedule the next background fetch. Passing back the success status to the callback will also allow to add error handling. BUG=665873, 672422 Committed: https://crrev.com/f6f620269ee0af3e7f8da7542a0cf04275248912 Cr-Commit-Position: refs/heads/master@{#437233}

Patch Set 1 #

Patch Set 2 : rebase #

Patch Set 3 : Fix compile error after rebase #

Patch Set 4 : Add a test #

Patch Set 5 : Rebase #

Patch Set 6 : Add a comment for the new pref #

Total comments: 24

Patch Set 7 : Address comments treib@ #

Total comments: 1

Patch Set 8 : Remove LOG(ERROR) dbg statment #

Total comments: 4

Patch Set 9 : Address comments treib #

Total comments: 4

Patch Set 10 : Address comments treib #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+128 lines, -35 lines) Patch
M components/ntp_snippets/pref_names.h View 1 2 3 4 5 6 1 chunk +3 lines, -0 lines 0 comments Download
M components/ntp_snippets/pref_names.cc View 1 2 3 4 5 6 7 8 1 chunk +3 lines, -0 lines 0 comments Download
M components/ntp_snippets/remote/ntp_snippets_fetcher.h View 1 2 3 4 5 6 7 8 2 chunks +7 lines, -6 lines 0 comments Download
M components/ntp_snippets/remote/ntp_snippets_fetcher.cc View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M components/ntp_snippets/remote/ntp_snippets_fetcher_unittest.cc View 1 2 3 4 5 6 7 8 9 17 chunks +54 lines, -26 lines 2 comments Download
M components/ntp_snippets/remote/remote_suggestions_provider.h View 1 2 3 4 5 6 7 8 3 chunks +11 lines, -0 lines 1 comment Download
M components/ntp_snippets/remote/remote_suggestions_provider.cc View 1 2 3 4 5 6 7 8 7 chunks +15 lines, -2 lines 1 comment Download
M components/ntp_snippets/remote/remote_suggestions_provider_unittest.cc View 1 2 3 4 5 6 7 8 9 2 chunks +34 lines, -0 lines 2 comments Download

Messages

Total messages: 47 (26 generated)
markusheintz_
Fix compile error after rebase
4 years ago (2016-12-05 16:24:13 UTC) #1
markusheintz_
Add a test
4 years ago (2016-12-07 09:32:30 UTC) #4
markusheintz_
Rebase onto master
4 years ago (2016-12-07 13:37:37 UTC) #9
markusheintz_
Add a comment for the new pref
4 years ago (2016-12-07 14:04:01 UTC) #12
markusheintz_
Marc can you please take a look at this CL?
4 years ago (2016-12-07 14:15:44 UTC) #15
Marc Treib
Thanks! Looks good overall, just a few nits. https://codereview.chromium.org/2549163002/diff/100001/components/ntp_snippets/pref_names.cc File components/ntp_snippets/pref_names.cc (right): https://codereview.chromium.org/2549163002/diff/100001/components/ntp_snippets/pref_names.cc#newcode45 components/ntp_snippets/pref_names.cc:45: "ntp_suggestions.articles.last_successfull_background_fetch_time"; ...
4 years ago (2016-12-07 14:42:13 UTC) #16
markusheintz_
Address comments treib@
4 years ago (2016-12-08 09:47:12 UTC) #17
markusheintz_
https://codereview.chromium.org/2549163002/diff/100001/components/ntp_snippets/pref_names.cc File components/ntp_snippets/pref_names.cc (right): https://codereview.chromium.org/2549163002/diff/100001/components/ntp_snippets/pref_names.cc#newcode45 components/ntp_snippets/pref_names.cc:45: "ntp_suggestions.articles.last_successfull_background_fetch_time"; On 2016/12/07 14:42:12, Marc Treib wrote: > s/articles/remote/ ...
4 years ago (2016-12-08 09:47:41 UTC) #20
markusheintz_
https://codereview.chromium.org/2549163002/diff/120001/components/ntp_snippets/remote/ntp_snippets_fetcher.cc File components/ntp_snippets/remote/ntp_snippets_fetcher.cc (right): https://codereview.chromium.org/2549163002/diff/120001/components/ntp_snippets/remote/ntp_snippets_fetcher.cc#newcode1000 components/ntp_snippets/remote/ntp_snippets_fetcher.cc:1000: LOG(ERROR) << " ================ ststus_code=" Removed
4 years ago (2016-12-08 09:50:24 UTC) #21
markusheintz_
Remove LOG(ERROR) dbg statment
4 years ago (2016-12-08 09:51:19 UTC) #22
Marc Treib
lgtm Thanks! LGTM with some last nits. (I'd prefer the parameters to be switched, but ...
4 years ago (2016-12-08 10:33:49 UTC) #23
Marc Treib
Per the recent discussion on CL descriptions: Could you - add "NTPSnippets: " or similar ...
4 years ago (2016-12-08 10:55:34 UTC) #25
markusheintz_
https://codereview.chromium.org/2549163002/diff/100001/components/ntp_snippets/remote/ntp_snippets_fetcher.h File components/ntp_snippets/remote/ntp_snippets_fetcher.h (right): https://codereview.chromium.org/2549163002/diff/100001/components/ntp_snippets/remote/ntp_snippets_fetcher.h#newcode103 components/ntp_snippets/remote/ntp_snippets_fetcher.h:103: FetchResult fetch_result)>; On 2016/12/08 10:33:48, Marc Treib wrote: > ...
4 years ago (2016-12-08 11:37:19 UTC) #27
markusheintz_
Address comments treib
4 years ago (2016-12-08 11:39:38 UTC) #31
Marc Treib
lgtm https://codereview.chromium.org/2549163002/diff/100001/components/ntp_snippets/remote/ntp_snippets_fetcher.h File components/ntp_snippets/remote/ntp_snippets_fetcher.h (right): https://codereview.chromium.org/2549163002/diff/100001/components/ntp_snippets/remote/ntp_snippets_fetcher.h#newcode103 components/ntp_snippets/remote/ntp_snippets_fetcher.h:103: FetchResult fetch_result)>; On 2016/12/08 11:37:18, markusheintz_ wrote: > ...
4 years ago (2016-12-08 12:15:40 UTC) #34
markusheintz_
Address comments treib
4 years ago (2016-12-08 12:22:47 UTC) #37
markusheintz_
https://codereview.chromium.org/2549163002/diff/160001/components/ntp_snippets/remote/ntp_snippets_fetcher_unittest.cc File components/ntp_snippets/remote/ntp_snippets_fetcher_unittest.cc (right): https://codereview.chromium.org/2549163002/diff/160001/components/ntp_snippets/remote/ntp_snippets_fetcher_unittest.cc#newcode63 components/ntp_snippets/remote/ntp_snippets_fetcher_unittest.cc:63: ACTION_P(MoveArgumentPointeeTo, ptr) { On 2016/12/08 12:15:40, Marc Treib wrote: ...
4 years ago (2016-12-08 12:23:48 UTC) #38
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/2549163002/180001
4 years ago (2016-12-08 12:24:07 UTC) #41
commit-bot: I haz the power
Committed patchset #10 (id:180001)
4 years ago (2016-12-08 13:02:58 UTC) #44
commit-bot: I haz the power
Patchset 10 (id:??) landed as https://crrev.com/f6f620269ee0af3e7f8da7542a0cf04275248912 Cr-Commit-Position: refs/heads/master@{#437233}
4 years ago (2016-12-08 13:04:54 UTC) #46
tschumann
4 years ago (2016-12-08 18:18:51 UTC) #47
Message was sent while issue was closed.
lgtm

some follow-up / bystander comments. I was just curious and had a quick look.
nothing too serious -- not even sure what's worth following up on. 
But I only realized you submitted after I finished the comments and don't want
to simply delete them unread ;-)

https://codereview.chromium.org/2549163002/diff/180001/components/ntp_snippet...
File components/ntp_snippets/remote/ntp_snippets_fetcher_unittest.cc (right):

https://codereview.chromium.org/2549163002/diff/180001/components/ntp_snippet...
components/ntp_snippets/remote/ntp_snippets_fetcher_unittest.cc:730:
.WillOnce(MoveArgument1PointeeTo(&fetched_categories));
nit: the matcher name is now a bit hard to understand. Alternatively you can use
::testing::WithArg<1> to extract the second argument and pass it into the
funciton:

.WillOnce(WithArg<0>(MoveArgumentPointeeTo(&...);

If this feels to complicated, I'm also fine with renaming the helper, but maybe
something easier to read like:
MoveSecondArgumentPointeeTo(...);

(the "1" is quite misleading as you don't expect 0-based indexing in usual
language).

https://codereview.chromium.org/2549163002/diff/180001/components/ntp_snippet...
components/ntp_snippets/remote/ntp_snippets_fetcher_unittest.cc:965: .Times(1);
nit: Times(1) can be omitted -- it's the default
(https://wiki.corp.google.com/twiki/bin/view/Main/GMockGuide#Cardinalities_How...)

So as long as this expectation is not a property tested by that test
specificallly, we should probably omit.

https://codereview.chromium.org/2549163002/diff/180001/components/ntp_snippet...
File components/ntp_snippets/remote/remote_suggestions_provider.cc (right):

https://codereview.chromium.org/2549163002/diff/180001/components/ntp_snippet...
components/ntp_snippets/remote/remote_suggestions_provider.cc:721:
pref_service_->SetInt64(prefs::kLastSuccessfulBackgroundFetchTime,
just a comment -- no need to action: I guess that we might want to move this
later to a place where we actually consume this data (guess that's going to be
the remote-fetching-mastermind-class). You'll have to ask this class before we
do any fetches and it seems then just symmetrical to also tell that class about
the outcome of the fetch.

No need to do this right now (not sure about the state of this), but if this
sounds reasonable, a TODO() would be nice to find a proper home for this sort of
book-keeping.

https://codereview.chromium.org/2549163002/diff/180001/components/ntp_snippet...
File components/ntp_snippets/remote/remote_suggestions_provider.h (right):

https://codereview.chromium.org/2549163002/diff/180001/components/ntp_snippet...
components/ntp_snippets/remote/remote_suggestions_provider.h:156: tick_clock_ =
std::move(tick_clock);
nit: Couldn't we dependency-inject this into the constructor instead?
ForTesting() functions have a certain smell.

https://codereview.chromium.org/2549163002/diff/180001/components/ntp_snippet...
File components/ntp_snippets/remote/remote_suggestions_provider_unittest.cc
(right):

https://codereview.chromium.org/2549163002/diff/180001/components/ntp_snippet...
components/ntp_snippets/remote/remote_suggestions_provider_unittest.cc:1612:
WaitForSnippetsServiceInitialization(service.get(),
can you add a comment explaining that a fetch request was already triggered (by
which method? I guess MakeSnippetsServiceWithoutInitialization) but queued in
the event-loop. So we're only going to see the effect after this function.

https://codereview.chromium.org/2549163002/diff/180001/components/ntp_snippet...
components/ntp_snippets/remote/remote_suggestions_provider_unittest.cc:1615:
simple_test_tick_clock_ptr->NowTicks().ToInternalValue(),
can you set up the clock's current time when initializing? How do I know it's
not initialized to zero and this just works accidentally?

Powered by Google App Engine
This is Rietveld 408576698