Waiting for wallpaper animation in widget tests only for Nexus Launcher and in postsubmit
This code flakes in postsubmit and presubmit, but the failure is not reproducible in local and abtd runs. Landing the change to make postsubmit flake; then I'll use tricks like tracing to debug the cause. Bug: 313926097 Flag: N/A Test: presubmit Change-Id: I77c324d43a2400fe1015f5cd0a4729e34552687c
This commit is contained in:
1 parent
d60f56c36e
commit
5eac9a5d81
1 file changed
+17
-7
@@ -40,6 +40,7 @@ import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape;
|
||||
import com.android.launcher3.ui.TestViewHelpers;
|
||||
import com.android.launcher3.util.Wait;
|
||||
import com.android.launcher3.util.rule.ShellCommandRule;
|
||||
import com.android.launcher3.util.rule.TestStabilityRule;
|
||||
import com.android.launcher3.widget.LauncherAppWidgetProviderInfo;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -101,7 +102,7 @@ public class TaplAddConfigWidgetTest extends AbstractLauncherUiTest {
|
||||
// Verify that the widget id is valid and bound
|
||||
assertNotNull(mAppWidgetManager.getAppWidgetInfo(mWidgetId));
|
||||
|
||||
setResult(acceptConfig);
|
||||
setResultAndWaitForAnimation(acceptConfig);
|
||||
if (acceptConfig) {
|
||||
Wait.atMost("", new WidgetSearchCondition(), DEFAULT_ACTIVITY_TIMEOUT, mLauncher);
|
||||
assertNotNull(mAppWidgetManager.getAppWidgetInfo(mWidgetId));
|
||||
@@ -112,12 +113,21 @@ public class TaplAddConfigWidgetTest extends AbstractLauncherUiTest {
|
||||
}
|
||||
}
|
||||
|
||||
private void setResult(boolean success) {
|
||||
mLauncher.executeAndWaitForWallpaperAnimation(() ->
|
||||
getInstrumentation().getTargetContext().sendBroadcast(
|
||||
WidgetConfigActivity.getCommandIntent(WidgetConfigActivity.class,
|
||||
success ? "clickOK" : "clickCancel")),
|
||||
"setting widget coinfig result");
|
||||
private static void setResult(boolean success) {
|
||||
getInstrumentation().getTargetContext().sendBroadcast(
|
||||
WidgetConfigActivity.getCommandIntent(WidgetConfigActivity.class,
|
||||
success ? "clickOK" : "clickCancel"));
|
||||
}
|
||||
|
||||
private void setResultAndWaitForAnimation(boolean success) {
|
||||
if (mLauncher.isLauncher3()
|
||||
|| TestStabilityRule.isPresubmit() /* b/313926097 */) {
|
||||
setResult(success);
|
||||
} else {
|
||||
mLauncher.executeAndWaitForWallpaperAnimation(
|
||||
() -> setResult(success),
|
||||
"setting widget coinfig result");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user