Commit 8e5436b6 authored by Alex Clarke's avatar Alex Clarke Committed by Commit Bot

Speculative fix for flakes in MainIntentBehaviorMetricsIntegrationTest

The generic problem seems to be startActivity(true) creates a NTP which
is a problem if ChromeTabbedActivity.setupCompositorContent runs before
that NTP is created because that creates a SimpleAnimationLayout which
tries to hide the page resulting in a MainIntentActionType.SWITCH_TABS.

Bug: 982081, 980587
Change-Id: I5324e63f1d115f3df4c819f4ec88857d10eff2f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1698536
Commit-Queue: Alex Clarke <alexclarke@chromium.org>
Commit-Queue: Peter Conn <peconn@chromium.org>
Auto-Submit: Alex Clarke <alexclarke@chromium.org>
Reviewed-by: default avatarPeter Conn <peconn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#676881}
parent 9fc2de60
...@@ -73,7 +73,11 @@ public class MainIntentBehaviorMetricsIntegrationTest { ...@@ -73,7 +73,11 @@ public class MainIntentBehaviorMetricsIntegrationTest {
@MediumTest @MediumTest
@Test @Test
public void testFocusOmnibox() { public void testFocusOmnibox() {
startActivity(true); // startActivity(true) creates a NTP which is problematical for this test if
// ChromeTabbedActivity.setupCompositorContent runs before that NTP is created because
// that creates a SimpleAnimationLayout which tries to hide the page resulting in a
// MainIntentActionType.SWITCH_TABS. Starting from about:blank avoids this confusion.
startActivityWithAboutBlank(true);
assertMainIntentBehavior(null); assertMainIntentBehavior(null);
TestThreadUtils.runOnUiThreadBlocking(() -> { TestThreadUtils.runOnUiThreadBlocking(() -> {
UrlBar urlBar = (UrlBar) mActivityTestRule.getActivity().findViewById(R.id.url_bar); UrlBar urlBar = (UrlBar) mActivityTestRule.getActivity().findViewById(R.id.url_bar);
...@@ -108,9 +112,12 @@ public class MainIntentBehaviorMetricsIntegrationTest { ...@@ -108,9 +112,12 @@ public class MainIntentBehaviorMetricsIntegrationTest {
@MediumTest @MediumTest
@Test @Test
@DisabledTest(message = "crbug.com/982081")
public void testBackgrounded() { public void testBackgrounded() {
startActivity(true); // startActivity(true) creates a NTP which is problematical for this test if
// ChromeTabbedActivity.setupCompositorContent runs before that NTP is created because
// that creates a SimpleAnimationLayout which tries to hide the page resulting in a
// MainIntentActionType.SWITCH_TABS. Starting from about:blank avoids this confusion.
startActivityWithAboutBlank(true);
assertMainIntentBehavior(null); assertMainIntentBehavior(null);
TestThreadUtils.runOnUiThreadBlocking(() -> mActivityTestRule.getActivity().finish()); TestThreadUtils.runOnUiThreadBlocking(() -> mActivityTestRule.getActivity().finish());
assertMainIntentBehavior(MainIntentBehaviorMetrics.MainIntentActionType.BACKGROUNDED); assertMainIntentBehavior(MainIntentBehaviorMetrics.MainIntentActionType.BACKGROUNDED);
...@@ -135,7 +142,11 @@ public class MainIntentBehaviorMetricsIntegrationTest { ...@@ -135,7 +142,11 @@ public class MainIntentBehaviorMetricsIntegrationTest {
public void testContinuation() { public void testContinuation() {
try { try {
MainIntentBehaviorMetrics.setTimeoutDurationMsForTesting(500); MainIntentBehaviorMetrics.setTimeoutDurationMsForTesting(500);
startActivity(true); // startActivity(true) creates a NTP which is problematical for this test if
// ChromeTabbedActivity.setupCompositorContent runs before that NTP is created because
// that creates a SimpleAnimationLayout which tries to hide the page resulting in a
// MainIntentActionType.SWITCH_TABS. Starting from about:blank avoids this confusion.
startActivityWithAboutBlank(true);
assertMainIntentBehavior(MainIntentBehaviorMetrics.MainIntentActionType.CONTINUATION); assertMainIntentBehavior(MainIntentBehaviorMetrics.MainIntentActionType.CONTINUATION);
} finally { } finally {
MainIntentBehaviorMetrics.setTimeoutDurationMsForTesting( MainIntentBehaviorMetrics.setTimeoutDurationMsForTesting(
......
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