Commit 63706137 authored by Marijn Kruisselbrink's avatar Marijn Kruisselbrink Committed by Commit Bot

Revert "Add title visibility option to Incognito CCT."

This reverts commit 34ec1547.

Reason for revert: Tests are flaky, see linked bugs.

Original change's description:
> Add title visibility option to Incognito CCT.
>
> This CL gives ability to Incognito CCT to show title on toolbar.
>
> For screenshot:
> https://drive.google.com/file/d/1WQFhK3yhVsF-OazSSrUh9d8mfpNb1ZeK
>
> Bug: 1104180
> Change-Id: I195ba2200d0994bb0aea5f06ce017ec81172e2a6
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2537677
> Commit-Queue: Side YILMAZ <sideyilmaz@chromium.org>
> Reviewed-by: Rohit Agarwal <roagarwal@chromium.org>
> Reviewed-by: Peter Conn <peconn@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#828235}

TBR=peconn@chromium.org,roagarwal@chromium.org,sideyilmaz@chromium.org

Change-Id: I16ccce7ebb6bd0dc1692e530545f33ed5ccfcfd7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1104180, 1150150, 1150083, 1150056 
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2545258
Commit-Queue: Marijn Kruisselbrink <mek@chromium.org>
Reviewed-by: default avatarMarijn Kruisselbrink <mek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828482}
parent 2d6649c1
......@@ -54,7 +54,6 @@ public class IncognitoCustomTabIntentDataProvider extends BrowserServicesIntentD
private final int mToolbarColor;
private final int mBottomBarColor;
private final int mNavigationBarColor;
private final int mTitleVisibilityState;
private final Drawable mCloseButtonIcon;
private final boolean mShowShareItem;
private final List<Pair<String, PendingIntent>> mMenuEntries = new ArrayList<>();
......@@ -90,8 +89,6 @@ public class IncognitoCustomTabIntentDataProvider extends BrowserServicesIntentD
mCloseButtonIcon = TintedDrawable.constructTintedDrawable(context, R.drawable.btn_close);
mShowShareItem = IntentUtils.safeGetBooleanExtra(
intent, CustomTabsIntent.EXTRA_DEFAULT_SHARE_MENU_ITEM, false);
mTitleVisibilityState = IntentUtils.safeGetIntExtra(
intent, CustomTabsIntent.EXTRA_TITLE_VISIBILITY_STATE, CustomTabsIntent.NO_TITLE);
mUiType = getUiType(intent);
updateExtraMenuItemsIfNecessary(intent);
......@@ -258,11 +255,6 @@ public class IncognitoCustomTabIntentDataProvider extends BrowserServicesIntentD
return mNavigationBarColor;
}
@Override
public int getTitleVisibilityState() {
return mTitleVisibilityState;
}
@Override
public boolean isOpenedByChrome() {
return mIsOpenedByChrome;
......
......@@ -32,7 +32,6 @@ import android.view.MenuItem;
import android.view.View;
import android.widget.ImageButton;
import android.widget.RemoteViews;
import android.widget.TextView;
import androidx.annotation.DrawableRes;
import androidx.appcompat.content.res.AppCompatResources;
......@@ -126,15 +125,6 @@ public class CustomTabActivityIncognitoTest {
});
}
private static boolean getTitleBarVisibility(CustomTabActivity activity)
throws ExecutionException {
return TestThreadUtils.runOnUiThreadBlocking(() -> {
CustomTabToolbar toolbar = activity.findViewById(R.id.toolbar);
TextView titleBar = toolbar.findViewById(R.id.title_bar);
return titleBar.getVisibility() == View.VISIBLE;
});
}
private void launchMenuItem() throws Exception {
Intent intent = createMinimalIncognitoCustomTabIntent();
CustomTabActivity activity = launchIncognitoCustomTab(intent);
......@@ -400,15 +390,4 @@ public class CustomTabActivityIncognitoTest {
View bottomBarView = mCustomTabActivityTestRule.getActivity().findViewById(R.id.bottom_bar);
assertTrue(bottomBarView == null);
}
@Test
@MediumTest
@Features.EnableFeatures({ChromeFeatureList.CCT_INCOGNITO})
public void ensureTitleBarIsVisibile() throws Exception {
Intent intent = createMinimalIncognitoCustomTabIntent();
intent.putExtra(
CustomTabsIntent.EXTRA_TITLE_VISIBILITY_STATE, CustomTabsIntent.SHOW_PAGE_TITLE);
CustomTabActivity activity = launchIncognitoCustomTab(intent);
Assert.assertTrue(getTitleBarVisibility(activity));
}
}
......@@ -4,19 +4,12 @@
package org.chromium.chrome.browser.customtabs;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.matcher.ViewMatchers.isRoot;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static org.junit.Assert.assertTrue;
import static org.chromium.chrome.test.util.ViewUtils.waitForView;
import android.content.Intent;
import android.support.test.InstrumentationRegistry;
import android.view.View;
import androidx.browser.customtabs.CustomTabsIntent;
import androidx.test.filters.MediumTest;
import org.junit.Before;
......@@ -34,7 +27,6 @@ import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.browser.incognito.IncognitoDataTestUtils;
import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate;
import org.chromium.chrome.test.util.ViewUtils;
import org.chromium.chrome.test.util.browser.Features;
import org.chromium.net.test.EmbeddedTestServerRule;
import org.chromium.ui.test.util.RenderTestRule;
......@@ -100,27 +92,10 @@ public class IncognitoCustomTabActivityRenderTest {
mRenderTestRule.render(toolbarView, renderTestId);
}
private void startActivityWithTitle(String renderTestId) throws IOException {
mCustomTabActivityTestRule.startCustomTabActivityWithIntent(mIntent);
View toolbarView = mCustomTabActivityTestRule.getActivity().findViewById(R.id.toolbar);
onView(isRoot()).check(waitForView(withId(R.id.title_bar), ViewUtils.VIEW_VISIBLE));
mRenderTestRule.render(toolbarView, renderTestId);
}
@Test
@MediumTest
@Feature("RenderTest")
public void testCCTToolbar() throws IOException {
startActivity("default_incognito_cct_toolbar_with_https_" + mRunWithHttps);
}
@Test
@MediumTest
@Feature("RenderTest")
public void testCCTTitleBar() throws IOException {
mIntent.putExtra(
CustomTabsIntent.EXTRA_TITLE_VISIBILITY_STATE, CustomTabsIntent.SHOW_PAGE_TITLE);
startActivityWithTitle(
"default_incognito_cct_toolbar_with_title_bar_and_with_https_" + mRunWithHttps);
}
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment