Commit 54c374db authored by spdonghao's avatar spdonghao Committed by Chromium LUCI CQ

[Instant Start] Remove unexpected toolbar shadow on start surface.

Demos:
Before this CL:
https://drive.google.com/file/d/1rGxWGyHhN1Nft2UQACOu6iH045dXhf7D/view?usp=sharing&resourcekey=0-iUuO4moaXQ1z4cqhbbzTdg
After this CL:
https://drive.google.com/file/d/1yjB2IVO0v7Kf2D---L3PVMhd_J4zbP9W/view?usp=sharing&resourcekey=0-Fyz_1WPerkvgv_2aBCVgVg

Bug: 1136245
Change-Id: Ia39231b975a12ec7f7739f428ba344d8005d5fcc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2564010Reviewed-by: default avatarXi Han <hanxi@chromium.org>
Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Reviewed-by: default avatarWei-Yin Chen (陳威尹) <wychen@chromium.org>
Commit-Queue: Hao Dong <spdonghao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833045}
parent 6ed1f87d
......@@ -107,6 +107,7 @@ import org.chromium.chrome.test.util.ChromeRenderTestRule;
import org.chromium.chrome.test.util.OmniboxTestUtils;
import org.chromium.chrome.test.util.ViewUtils;
import org.chromium.chrome.test.util.browser.Features;
import org.chromium.chrome.test.util.browser.Features.DisableFeatures;
import org.chromium.chrome.test.util.browser.Features.EnableFeatures;
import org.chromium.components.user_prefs.UserPrefs;
import org.chromium.content_public.browser.test.util.TestThreadUtils;
......@@ -997,6 +998,43 @@ public class InstantStartTest {
mRenderTestRule.render(surface, "singlePane_floatingTopToolbar");
}
@Test
@SmallTest
@Restriction({UiRestriction.RESTRICTION_TYPE_PHONE})
// clang-format off
@EnableFeatures({ChromeFeatureList.TAB_SWITCHER_ON_RETURN + "<Study,",
ChromeFeatureList.START_SURFACE_ANDROID + "<Study"})
@CommandLineFlags.Add({ChromeSwitches.DISABLE_NATIVE_INITIALIZATION,
"force-fieldtrials=Study/Group",
IMMEDIATE_RETURN_PARAMS + "/start_surface_variation/single"})
public void testShadowVisibility() throws IOException {
// clang-format on
startMainActivityFromLauncher();
CriteriaHelper.pollUiThread(
() -> mActivityTestRule.getActivity().getLayoutManager().overviewVisible());
int shadowVisibility =
mActivityTestRule.getActivity().findViewById(R.id.toolbar_shadow).getVisibility();
Assert.assertEquals(View.INVISIBLE, shadowVisibility);
}
@Test
@SmallTest
@Restriction({UiRestriction.RESTRICTION_TYPE_PHONE})
// clang-format off
@EnableFeatures({ChromeFeatureList.TAB_SWITCHER_ON_RETURN + "<Study,",
ChromeFeatureList.START_SURFACE_ANDROID + "<Study"})
@DisableFeatures(ChromeFeatureList.INSTANT_START)
@CommandLineFlags.Add({ChromeSwitches.DISABLE_NATIVE_INITIALIZATION,
"force-fieldtrials=Study/Group",
IMMEDIATE_RETURN_PARAMS + "/start_surface_variation/single"})
public void testShadowVisibilityWithoutInstantStart() throws IOException {
// clang-format on
startMainActivityFromLauncher();
onViewWaiting(withId(R.id.toolbar_shadow)).check(matches(isDisplayed()));
}
/**
* Toggles the header and checks whether the header has the right status.
*
......
......@@ -1488,6 +1488,7 @@ public class ToolbarPhone extends ToolbarLayout implements OnClickListener, TabC
super.onAttachedToWindow();
mToolbarShadow = (ImageView) getRootView().findViewById(R.id.toolbar_shadow);
updateShadowVisibility();
// This is a workaround for http://crbug.com/574928. Since Jelly Bean is the lowest version
// we support now and the next deprecation target, we decided to simply workaround.
......
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