Commit ac0e2c90 authored by Wei-Yin Chen (陳威尹)'s avatar Wei-Yin Chen (陳威尹) Committed by Commit Bot

Add RenderTests in StartSurfaceLayoutTest for native tab

Add one more RenderTest for native tab. Choose NTP in incognito mode
for its consistency.

Also fix the issue about thumbnails being not freed in
http://crrev.com/c/1903402.

Bug: 983170
Change-Id: I68d3f08184cb4b9504935a53f893bb7ea9473ba6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1903620
Commit-Queue: Wei-Yin Chen (陳威尹) <wychen@chromium.org>
Reviewed-by: default avatarYue Zhang <yuezhanggg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713961}
parent 5b753f47
......@@ -132,9 +132,7 @@ public class StartSurfaceLayoutTest {
.getCurrentTabModelFilter()::isTabModelRestored));
assertEquals(0, mTabListDelegate.getBitmapFetchCountForTesting());
// Only skip thumbnail releasing assertion when "warm" (large soft-cleanup-delay) or in
// RenderTest.
// TODO(wychen): figure out why thumbnails are not released in RenderTest.
// Only skip thumbnail releasing assertion when "warm" (large soft-cleanup-delay).
mSkipAssertThumbnailsAreReleased = false;
}
......@@ -148,16 +146,14 @@ public class StartSurfaceLayoutTest {
@Feature({"RenderTest"})
@CommandLineFlags.Add({BASE_PARAMS})
public void testRenderGrid_3WebTabs() throws InterruptedException, IOException {
mSkipAssertThumbnailsAreReleased = true;
prepareTabs(3, 0, mUrl);
TabUiTestHelper.enterTabSwitcher(mActivityTestRule.getActivity());
TabUiTestHelper.clickFirstCardFromTabSwitcher(mActivityTestRule.getActivity());
enterGTS();
mRenderTestRule.render(mActivityTestRule.getActivity().findViewById(
org.chromium.chrome.tab_ui.R.id.tab_list_view),
"3_web_tabs");
mRenderTestRule.render(
mActivityTestRule.getActivity().findViewById(R.id.tab_list_view), "3_web_tabs");
leaveGTS();
}
@Test
......@@ -165,16 +161,14 @@ public class StartSurfaceLayoutTest {
@Feature({"RenderTest"})
@CommandLineFlags.Add({BASE_PARAMS})
public void testRenderGrid_10WebTabs() throws InterruptedException, IOException {
mSkipAssertThumbnailsAreReleased = true;
prepareTabs(10, 0, mUrl);
TabUiTestHelper.enterTabSwitcher(mActivityTestRule.getActivity());
TabUiTestHelper.clickFirstCardFromTabSwitcher(mActivityTestRule.getActivity());
enterGTS();
mRenderTestRule.render(mActivityTestRule.getActivity().findViewById(
org.chromium.chrome.tab_ui.R.id.tab_list_view),
"10_web_tabs");
mRenderTestRule.render(
mActivityTestRule.getActivity().findViewById(R.id.tab_list_view), "10_web_tabs");
leaveGTS();
}
@Test
......@@ -182,8 +176,6 @@ public class StartSurfaceLayoutTest {
@Feature({"RenderTest"})
@CommandLineFlags.Add({BASE_PARAMS})
public void testRenderGrid_10WebTabs_InitialScroll() throws InterruptedException, IOException {
mSkipAssertThumbnailsAreReleased = true;
prepareTabs(10, 0, mUrl);
TabUiTestHelper.enterTabSwitcher(mActivityTestRule.getActivity());
TabUiTestHelper.clickNthCardFromTabSwitcher(mActivityTestRule.getActivity(),
......@@ -192,9 +184,9 @@ public class StartSurfaceLayoutTest {
enterGTS();
// Make sure the grid tab switcher is scrolled down to show the selected tab.
mRenderTestRule.render(mActivityTestRule.getActivity().findViewById(
org.chromium.chrome.tab_ui.R.id.tab_list_view),
mRenderTestRule.render(mActivityTestRule.getActivity().findViewById(R.id.tab_list_view),
"10_web_tabs-select_last");
leaveGTS();
}
@Test
......@@ -202,8 +194,6 @@ public class StartSurfaceLayoutTest {
@Feature({"RenderTest"})
@CommandLineFlags.Add({BASE_PARAMS})
public void testRenderGrid_Incognito() throws InterruptedException, IOException {
mSkipAssertThumbnailsAreReleased = true;
// Prepare some incognito tabs and enter tab switcher.
prepareTabs(1, 3, mUrl);
assertTrue(mActivityTestRule.getActivity().getCurrentTabModel().isIncognito());
......@@ -211,9 +201,28 @@ public class StartSurfaceLayoutTest {
TabUiTestHelper.clickFirstCardFromTabSwitcher(mActivityTestRule.getActivity());
enterGTS();
mRenderTestRule.render(mActivityTestRule.getActivity().findViewById(
org.chromium.chrome.tab_ui.R.id.tab_list_view),
mRenderTestRule.render(mActivityTestRule.getActivity().findViewById(R.id.tab_list_view),
"3_incognito_web_tabs");
leaveGTS();
}
@Test
@MediumTest
@Feature({"RenderTest"})
@CommandLineFlags.Add({BASE_PARAMS})
public void testRenderGrid_3IncognitoNTPs() throws InterruptedException, IOException {
// Prepare some incognito native tabs and enter tab switcher.
// NTP in incognito mode is chosen for its consistency in look, and we don't have to mock
// away the MV tiles, login promo, feed, etc.
prepareTabs(1, 3, null);
assertTrue(mActivityTestRule.getActivity().getCurrentTabModel().isIncognito());
TabUiTestHelper.enterTabSwitcher(mActivityTestRule.getActivity());
TabUiTestHelper.clickFirstCardFromTabSwitcher(mActivityTestRule.getActivity());
enterGTS();
mRenderTestRule.render(mActivityTestRule.getActivity().findViewById(R.id.tab_list_view),
"3_incognito_ntps");
leaveGTS();
}
@Test
......@@ -459,7 +468,7 @@ public class StartSurfaceLayoutTest {
waitForCaptureRateControl();
}
int count = getCaptureCount();
onView(withId(org.chromium.chrome.tab_ui.R.id.tab_list_view))
onView(withId(R.id.tab_list_view))
.perform(RecyclerViewActions.actionOnItemAtPosition(targetIndex, click()));
CriteriaHelper.pollUiThread(() -> {
boolean doneHiding =
......@@ -582,16 +591,16 @@ public class StartSurfaceLayoutTest {
public void testIncognitoEnterGts() throws InterruptedException {
prepareTabs(1, 1, null);
enterGTS();
onView(withId(org.chromium.chrome.tab_ui.R.id.tab_list_view))
onView(withId(R.id.tab_list_view))
.check(TabCountAssertion.havingTabCount(1));
onView(withId(org.chromium.chrome.tab_ui.R.id.tab_list_view))
onView(withId(R.id.tab_list_view))
.perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));
CriteriaHelper.pollInstrumentationThread(
() -> !mActivityTestRule.getActivity().getLayoutManager().overviewVisible());
enterGTS();
onView(withId(org.chromium.chrome.tab_ui.R.id.tab_list_view))
onView(withId(R.id.tab_list_view))
.check(TabCountAssertion.havingTabCount(1));
}
......@@ -604,16 +613,16 @@ public class StartSurfaceLayoutTest {
// Prepare two incognito tabs and enter tab switcher.
prepareTabs(1, 2, mUrl);
enterGTS();
onView(withId(org.chromium.chrome.tab_ui.R.id.tab_list_view))
onView(withId(R.id.tab_list_view))
.check(TabCountAssertion.havingTabCount(2));
for (int i = 0; i < mRepeat; i++) {
switchTabModel(false);
onView(withId(org.chromium.chrome.tab_ui.R.id.tab_list_view))
onView(withId(R.id.tab_list_view))
.check(TabCountAssertion.havingTabCount(1));
switchTabModel(true);
onView(withId(org.chromium.chrome.tab_ui.R.id.tab_list_view))
onView(withId(R.id.tab_list_view))
.check(TabCountAssertion.havingTabCount(2));
}
leaveGTS();
......
aa72b682f2a1056919067f870c576e0f9f531302
\ 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