Skip to content

Commit

Permalink
[About this site] Hide ‘About this page’ header when improved bottoms…
Browse files Browse the repository at this point in the history
…heet feature flag is enabled

Add ‘ilrm=minimal,nohead’ to url when
kPageInfoAboutThisSiteImprovedBottomSheet is enabled.

Bug: 1358923
Change-Id: I7b4070ae4b525136d4bfaba7e2c231fc413f55af
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4194276
Reviewed-by: Ehimare Okoyomon <eokoyomon@chromium.org>
Commit-Queue: Ehimare Okoyomon <eokoyomon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1097848}
  • Loading branch information
Zaina Al-Mashni authored and Chromium LUCI CQ committed Jan 27, 2023
1 parent 7197927 commit 7cea78b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ private void openUrl(String url, @PageInfoAction int action) {
// Append parameter to open the page with reduced UI elements in the bottomsheet.
Uri.Builder builder = Uri.parse(url).buildUpon();
if (mSiteInfo.hasMoreAbout() && url.equals(mSiteInfo.getMoreAbout().getUrl())) {
builder.appendQueryParameter("ilrm", "minimal,nohead");
if (ChromeFeatureList.isEnabled(
ChromeFeatureList.PAGE_INFO_ABOUT_THIS_SITE_IMPROVED_BOTTOMSHEET)) {
builder.appendQueryParameter("ilrm", "minimal,nohead");
} else {
builder.appendQueryParameter("ilrm", "minimal");
}
}
GURL bottomSheetUrl = new GURL(builder.toString());
GURL fullPageUrl = new GURL(url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeTabbedActivity;
import org.chromium.chrome.browser.compositor.bottombar.ephemeraltab.EphemeralTabCoordinator;
import org.chromium.chrome.browser.compositor.bottombar.ephemeraltab.EphemeralTabObserver;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.browser.tab.Tab;
Expand Down Expand Up @@ -308,6 +309,28 @@ public void willAddTab(Tab tab, @TabLaunchType int type) {

onView(withId(PageInfoAboutThisSiteController.ROW_ID)).perform(click());
String moreAboutUrl = mTestServerRule.getServer().getURL(sAboutHtml);
verify(mMockEphemeralTabCoordinator)
.requestOpenSheetWithFullPageUrl(
/*url=*/new GURL(moreAboutUrl + "?ilrm=minimal"),
/*fullPageUrl=*/new GURL(moreAboutUrl), /*title=*/"About this page",
/*isIncognito=*/false);
verify(mMockAboutThisSiteJni).onAboutThisSiteRowClicked(true);
}

@Test
@MediumTest
@Features.EnableFeatures({ChromeFeatureList.PAGE_INFO_ABOUT_THIS_SITE_EN,
ChromeFeatureList.PAGE_INFO_ABOUT_THIS_SITE_NON_EN,
ChromeFeatureList.PAGE_INFO_ABOUT_THIS_SITE_MORE_INFO,
ChromeFeatureList.PAGE_INFO_ABOUT_THIS_SITE_IMPROVED_BOTTOMSHEET})
public void
testAboutThisSiteOpensEphemeralTabWithImprovedBottomSheetEnabled() throws Exception {
mockResponse(createDescription());
openPageInfo();

onView(withId(PageInfoAboutThisSiteController.ROW_ID)).perform(click());
String moreAboutUrl = mTestServerRule.getServer().getURL(sAboutHtml);
verify(mMockEphemeralTabCoordinator).addObserver(any(EphemeralTabObserver.class));
// %2C is used to escape the comma in the url.
verify(mMockEphemeralTabCoordinator)
.requestOpenSheetWithFullPageUrl(
Expand Down

0 comments on commit 7cea78b

Please sign in to comment.