|
|
Chromium Code Reviews|
Created:
3 years, 9 months ago by jkrcal Modified:
3 years, 8 months ago CC:
chromium-reviews, ios-reviews+chrome_chromium.org, ntp-dev+reviews_chromium.org, droger+watchlist_chromium.org, pkl (ping after 24h if needed), blundell+watchlist_chromium.org, sdefresne+watchlist_chromium.org, noyau+watch_chromium.org, ios-reviews_chromium.org, marq+watch_chromium.org, sdefresne+watch_chromium.org Target Ref:
refs/heads/master Project:
chromium Visibility:
Public. |
Description[Remote suggestions] Do not fetch before EULA accepted
This CL makes sure we never fetch snippets before EULA gets accepted by
the user (if the platforms supports accepting EULA on FRE).
BUG=676662
Review-Url: https://codereview.chromium.org/2759943002
Cr-Commit-Position: refs/heads/master@{#460348}
Committed: https://chromium.googlesource.com/chromium/src/+/f7081f8bb1607bc160ff793fd02cf257d04c6ef8
Patch Set 1 #Patch Set 2 : Fix unit-test #
Total comments: 4
Patch Set 3 : Tim's comments #
Total comments: 2
Patch Set 4 : Tim's comments #2 #
Total comments: 14
Patch Set 5 : Tim's comments #3 #Patch Set 6 : Rebase and fix GN deps (adding the new dep into tests as well) #Patch Set 7 : Fix android and ios unit-tests #Patch Set 8 : Fix compilation #
Dependent Patchsets: Messages
Total messages: 40 (26 generated)
jkrcal@chromium.org changed reviewers: + tschumann@chromium.org
Tim, could you PTAL? (feel free to relay to someone else if you are too busy, pre-vacation)
The CQ bit was checked by jkrcal@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: ios-simulator-xcode-clang on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator-xco...)
The CQ bit was checked by jkrcal@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
sorry for the delay! https://codereview.chromium.org/2759943002/diff/20001/components/ntp_snippets... File components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h (right): https://codereview.chromium.org/2759943002/diff/20001/components/ntp_snippets... components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h:62: public web_resource::EulaAcceptedNotifier::Observer { as you know, I'm trying to avoid multiple inheritance. In this case, we can actually quite nicely use aggregation as the observer is using the RemoteSuggestionsScheduler's public interface. So why not have a small class like EulaState with a constructor taking the local_state_prefs and remote suggestions scheduler. EulaState would also encapsulate the notifier (so no doubt if it's null or not) The SchedulingRemoteSuggestionsProvider's constructor can instantiate build it and simply ask that state for all info it needs. WDYT?
PTAL again! https://codereview.chromium.org/2759943002/diff/20001/components/ntp_snippets... File components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h (right): https://codereview.chromium.org/2759943002/diff/20001/components/ntp_snippets... components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h:62: public web_resource::EulaAcceptedNotifier::Observer { On 2017/03/21 20:13:15, tschumann wrote: > as you know, I'm trying to avoid multiple inheritance. > In this case, we can actually quite nicely use aggregation as the observer is > using the RemoteSuggestionsScheduler's public interface. > > So why not have a small class like EulaState with a constructor taking the > local_state_prefs and remote suggestions scheduler. EulaState would also > encapsulate the notifier (so no doubt if it's null or not) > The SchedulingRemoteSuggestionsProvider's constructor can instantiate build it > and simply ask that state for all info it needs. WDYT? Done. WDYT?
https://codereview.chromium.org/2759943002/diff/20001/components/ntp_snippets... File components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h (right): https://codereview.chromium.org/2759943002/diff/20001/components/ntp_snippets... components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h:62: public web_resource::EulaAcceptedNotifier::Observer { On 2017/03/22 09:36:04, jkrcal wrote: > On 2017/03/21 20:13:15, tschumann wrote: > > as you know, I'm trying to avoid multiple inheritance. > > In this case, we can actually quite nicely use aggregation as the observer is > > using the RemoteSuggestionsScheduler's public interface. > > > > So why not have a small class like EulaState with a constructor taking the > > local_state_prefs and remote suggestions scheduler. EulaState would also > > encapsulate the notifier (so no doubt if it's null or not) > > The SchedulingRemoteSuggestionsProvider's constructor can instantiate build it > > and simply ask that state for all info it needs. WDYT? > > Done. WDYT? Thanks! The cyclic dependency is still a bit of a smell but I don't see and easy way to improve this. https://codereview.chromium.org/2759943002/diff/40001/components/ntp_snippets... File components/ntp_snippets/remote/scheduling_remote_suggestions_provider_unittest.cc (right): https://codereview.chromium.org/2759943002/diff/40001/components/ntp_snippets... components/ntp_snippets/remote/scheduling_remote_suggestions_provider_unittest.cc:151: (I could have sworn I wrote this comment yesterday already, but apparently not...) Please add a unit-test making sure we're not fetching before the EULA got accepted. (https://codesearch.chromium.org/chromium/src/components/web_resource/eula_acc... has some hints how to do this easily).
Added the unit-test. It is a bit messy because on some platforms the EulaNotifier is not constructed and I want the tests to pass on all platforms. PTAL. https://codereview.chromium.org/2759943002/diff/20001/components/ntp_snippets... File components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h (right): https://codereview.chromium.org/2759943002/diff/20001/components/ntp_snippets... components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h:62: public web_resource::EulaAcceptedNotifier::Observer { On 2017/03/22 09:47:01, tschumann wrote: > On 2017/03/22 09:36:04, jkrcal wrote: > > On 2017/03/21 20:13:15, tschumann wrote: > > > as you know, I'm trying to avoid multiple inheritance. > > > In this case, we can actually quite nicely use aggregation as the observer > is > > > using the RemoteSuggestionsScheduler's public interface. > > > > > > So why not have a small class like EulaState with a constructor taking the > > > local_state_prefs and remote suggestions scheduler. EulaState would also > > > encapsulate the notifier (so no doubt if it's null or not) > > > The SchedulingRemoteSuggestionsProvider's constructor can instantiate build > it > > > and simply ask that state for all info it needs. WDYT? > > > > Done. WDYT? > > Thanks! The cyclic dependency is still a bit of a smell but I don't see and easy > way to improve this. Acknowledged. https://codereview.chromium.org/2759943002/diff/40001/components/ntp_snippets... File components/ntp_snippets/remote/scheduling_remote_suggestions_provider_unittest.cc (right): https://codereview.chromium.org/2759943002/diff/40001/components/ntp_snippets... components/ntp_snippets/remote/scheduling_remote_suggestions_provider_unittest.cc:151: On 2017/03/22 09:47:02, tschumann wrote: > (I could have sworn I wrote this comment yesterday already, but apparently > not...) > Please add a unit-test making sure we're not fetching before the EULA got > accepted. > (https://codesearch.chromium.org/chromium/src/components/web_resource/eula_acc... > has some hints how to do this easily). Done.
lgtm some nits left. Thanks! https://codereview.chromium.org/2759943002/diff/60001/components/ntp_snippets... File components/ntp_snippets/remote/scheduling_remote_suggestions_provider_unittest.cc (right): https://codereview.chromium.org/2759943002/diff/60001/components/ntp_snippets... components/ntp_snippets/remote/scheduling_remote_suggestions_provider_unittest.cc:172: return web_resource::EulaAcceptedNotifier::Create(&local_state_); let's make this more specific and add != nullptr you can then reduce the comment to: // Create() returns a unique_ptr, so this is no leak. https://codereview.chromium.org/2759943002/diff/60001/components/ntp_snippets... components/ntp_snippets/remote/scheduling_remote_suggestions_provider_unittest.cc:203: void ActivateUnderlyingProviderWithoutEula() { I'd get rid of this function as it's misleading. This function has no control over whether Eula was accepted or not. https://codereview.chromium.org/2759943002/diff/60001/components/ntp_snippets... components/ntp_snippets/remote/scheduling_remote_suggestions_provider_unittest.cc:229: // Do not run the test if Eula notifier is available // Only run this tests on platforms that don't support Eula. ? https://codereview.chromium.org/2759943002/diff/60001/components/ntp_snippets... components/ntp_snippets/remote/scheduling_remote_suggestions_provider_unittest.cc:234: // First enable the scheduler. together with the comment about inlining ActivateUnderlyingProviderWithoutEula(). // Activating the provider should schedule the background fetch. EXPECT_CALL(persistent_scheduler_, Schedule(_, _)); scheduling_provider_->OnProviderActivated(); // Verify fetches get triggered. EXPECT_CALL(*underlying_provider_, RefetchInTheBackground(_)); scheduling_provider_->OnPersistentSchedulerWakeUp(); https://codereview.chromium.org/2759943002/diff/60001/components/ntp_snippets... components/ntp_snippets/remote/scheduling_remote_suggestions_provider_unittest.cc:246: // Do not run the test if Eula notifier is not available. // Only run this tests on platforms supporting Eula. https://codereview.chromium.org/2759943002/diff/60001/components/ntp_snippets... components/ntp_snippets/remote/scheduling_remote_suggestions_provider_unittest.cc:250: // First enable the scheduler. // Activating the provider should schedule the background fetch. ? https://codereview.chromium.org/2759943002/diff/60001/components/ntp_snippets... components/ntp_snippets/remote/scheduling_remote_suggestions_provider_unittest.cc:263: // Do not run the test if Eula notifier is not available. Only run this tests on platforms supporting Eula.
jkrcal@chromium.org changed reviewers: + achuith@chromium.org, noyau@chromium.org
Thanks, Tim! Achuith, could you PTAL at +components/web_resource? Éric, could you PTAL at ios factory? https://codereview.chromium.org/2759943002/diff/60001/components/ntp_snippets... File components/ntp_snippets/remote/scheduling_remote_suggestions_provider_unittest.cc (right): https://codereview.chromium.org/2759943002/diff/60001/components/ntp_snippets... components/ntp_snippets/remote/scheduling_remote_suggestions_provider_unittest.cc:172: return web_resource::EulaAcceptedNotifier::Create(&local_state_); On 2017/03/22 17:56:41, tschumann wrote: > let's make this more specific and add != nullptr > you can then reduce the comment to: > // Create() returns a unique_ptr, so this is no leak. Done. https://codereview.chromium.org/2759943002/diff/60001/components/ntp_snippets... components/ntp_snippets/remote/scheduling_remote_suggestions_provider_unittest.cc:203: void ActivateUnderlyingProviderWithoutEula() { On 2017/03/22 17:56:41, tschumann wrote: > I'd get rid of this function as it's misleading. This function has no control > over whether Eula was accepted or not. Done. https://codereview.chromium.org/2759943002/diff/60001/components/ntp_snippets... components/ntp_snippets/remote/scheduling_remote_suggestions_provider_unittest.cc:229: // Do not run the test if Eula notifier is available On 2017/03/22 17:56:41, tschumann wrote: > // Only run this tests on platforms that don't support Eula. > ? Done. https://codereview.chromium.org/2759943002/diff/60001/components/ntp_snippets... components/ntp_snippets/remote/scheduling_remote_suggestions_provider_unittest.cc:234: // First enable the scheduler. On 2017/03/22 17:56:41, tschumann wrote: > together with the comment about inlining > ActivateUnderlyingProviderWithoutEula(). > // Activating the provider should schedule the background fetch. > EXPECT_CALL(persistent_scheduler_, Schedule(_, _)); > scheduling_provider_->OnProviderActivated(); > // Verify fetches get triggered. > EXPECT_CALL(*underlying_provider_, RefetchInTheBackground(_)); > scheduling_provider_->OnPersistentSchedulerWakeUp(); Done. https://codereview.chromium.org/2759943002/diff/60001/components/ntp_snippets... components/ntp_snippets/remote/scheduling_remote_suggestions_provider_unittest.cc:246: // Do not run the test if Eula notifier is not available. On 2017/03/22 17:56:41, tschumann wrote: > // Only run this tests on platforms supporting Eula. Done. https://codereview.chromium.org/2759943002/diff/60001/components/ntp_snippets... components/ntp_snippets/remote/scheduling_remote_suggestions_provider_unittest.cc:250: // First enable the scheduler. On 2017/03/22 17:56:41, tschumann wrote: > // Activating the provider should schedule the background fetch. > ? Done. https://codereview.chromium.org/2759943002/diff/60001/components/ntp_snippets... components/ntp_snippets/remote/scheduling_remote_suggestions_provider_unittest.cc:263: // Do not run the test if Eula notifier is not available. On 2017/03/22 17:56:41, tschumann wrote: > Only run this tests on platforms supporting Eula. Done.
On 2017/03/23 09:29:44, jkrcal wrote: > Thanks, Tim! > > Achuith, could you PTAL at +components/web_resource? There're no components/web_resource files in this CL
On 2017/03/23 18:00:18, achuithb wrote: > On 2017/03/23 09:29:44, jkrcal wrote: > > Thanks, Tim! > > > > Achuith, could you PTAL at +components/web_resource? > > There're no components/web_resource files in this CL I am sorry, I was not verbose enough. It is an added DEPS entry.
On 2017/03/23 18:10:11, jkrcal wrote: > On 2017/03/23 18:00:18, achuithb wrote: > > On 2017/03/23 09:29:44, jkrcal wrote: > > > Thanks, Tim! > > > > > > Achuith, could you PTAL at +components/web_resource? > > > > There're no components/web_resource files in this CL > > I am sorry, I was not verbose enough. It is an added DEPS entry. lgtm DEPS
Thanks! Éric, friendly ping!
ios lgtm.
The CQ bit was checked by jkrcal@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: mac_chromium_compile_dbg_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_comp...) mac_chromium_rel_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_...)
The CQ bit was checked by jkrcal@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/bui...)
The CQ bit was checked by jkrcal@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by jkrcal@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from tschumann@chromium.org, achuith@chromium.org, noyau@chromium.org Link to the patchset: https://codereview.chromium.org/2759943002/#ps140001 (title: "Fix compilation")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch.
Bot data: {"patchset_id": 140001, "attempt_start_ts": 1490785467564660,
"parent_rev": "69fd1b5798090316e9969c007aaf88cd5da6ef76", "commit_rev":
"f7081f8bb1607bc160ff793fd02cf257d04c6ef8"}
Message was sent while issue was closed.
Description was changed from ========== [Remote suggestions] Do not fetch before EULA accepted This CL makes sure we never fetch snippets before EULA gets accepted by the user (if the platforms supports accepting EULA on FRE). BUG=676662 ========== to ========== [Remote suggestions] Do not fetch before EULA accepted This CL makes sure we never fetch snippets before EULA gets accepted by the user (if the platforms supports accepting EULA on FRE). BUG=676662 Review-Url: https://codereview.chromium.org/2759943002 Cr-Commit-Position: refs/heads/master@{#460348} Committed: https://chromium.googlesource.com/chromium/src/+/f7081f8bb1607bc160ff793fd02c... ==========
Message was sent while issue was closed.
Committed patchset #8 (id:140001) as https://chromium.googlesource.com/chromium/src/+/f7081f8bb1607bc160ff793fd02c... |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
