Skip to content

Commit

Permalink
Ensure headers are added even if mFeedEnabled starts false.
Browse files Browse the repository at this point in the history
(cherry picked from commit 9777373)

Bug: 1305874
Change-Id: I10453fd009050d6eb8145818aef80043f158fa98
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3647985
Reviewed-by: Justin DeWitt <dewittj@chromium.org>
Commit-Queue: Cathy Li <chili@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1004604}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3661171
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/5060@{#185}
Cr-Branched-From: b83393d-refs/heads/main@{#1002911}
  • Loading branch information
Cathy Li authored and Chromium LUCI CQ committed May 23, 2022
1 parent 8c1ac71 commit 715cbf7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ private void initialize() {
/** Update the content based on supervised user or enterprise policy. */
void updateContent() {
mFeedEnabled = FeedFeatures.isFeedEnabled();
if (mFeedEnabled == !mTabToStreamMap.isEmpty()) {
if (mFeedEnabled && !mTabToStreamMap.isEmpty()) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,21 @@ public void testUpdateContent_policyFeedOffOn() {
assertEquals(2, mFeedSurfaceMediator.getTabToStreamSizeForTesting());
}

@Test
public void testUpdateContent_policyOff() {
PropertyModel sectionHeaderModel = SectionHeaderListProperties.create(TOOLBAR_HEIGHT);
mFeedSurfaceMediator =
createMediator(FeedSurfaceCoordinator.StreamTabId.FOLLOWING, sectionHeaderModel);
mFeedSurfaceMediator.onSurfaceOpened();

// Turn feed off.
when(mPrefService.getBoolean(Pref.ENABLE_SNIPPETS)).thenReturn(false);
mFeedSurfaceMediator.updateContent();

verify(mFeedSurfaceCoordinator).setupHeaders(false);
assertEquals(0, mFeedSurfaceMediator.getTabToStreamSizeForTesting());
}

@Test
public void testOnSurfaceClosed_launchInProgress() {
when(mPrefService.getBoolean(Pref.ARTICLES_LIST_VISIBLE)).thenReturn(true);
Expand Down

0 comments on commit 715cbf7

Please sign in to comment.