Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ec072e08 authored by Vadim Tryshev's avatar Vadim Tryshev
Browse files

Adding an annotation for tests that change nothing on screen and may produce no view capture data

Bug: 286251603
Test: presubmit
Flag: N/A
Change-Id: I3a6822648981400a426a09315aba36cb4977e6e9
parent 9f34a29d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.ui.AbstractLauncherUiTest;
import com.android.launcher3.util.LauncherBindableItemsContainer.ItemOperator;
import com.android.launcher3.util.rule.ViewCaptureRule;

import org.junit.After;
import org.junit.Test;
@@ -95,6 +96,7 @@ public class PromiseIconUiTest extends AbstractLauncherUiTest {
    }

    @Test
    @ViewCaptureRule.MayProduceNoFrames
    public void testPromiseIcon_notAddedFromIneligibleSession() throws Throwable {
        final String appLabel = "Test Promise App " + UUID.randomUUID().toString();
        final ItemOperator findPromiseApp = (info, view) ->
+7 −1
Original line number Diff line number Diff line
@@ -132,7 +132,9 @@ class ViewCaptureRule(var alreadyOpenActivitySupplier: Supplier<Activity?>) : Te
        for (i in 0 until viewCaptureData!!.windowDataCount) {
            frameCount += viewCaptureData!!.getWindowData(i).frameDataCount
        }
        assertTrue("Empty ViewCapture data", frameCount > 0)

        val mayProduceNoFrames = description.getAnnotation(MayProduceNoFrames::class.java) != null
        assertTrue("Empty ViewCapture data", mayProduceNoFrames || frameCount > 0)

        val anomalies: Map<String, String> = ViewCaptureAnalyzer.getAnomalies(viewCaptureData)
        if (!anomalies.isEmpty()) {
@@ -159,4 +161,8 @@ class ViewCaptureRule(var alreadyOpenActivitySupplier: Supplier<Activity?>) : Te
            )
        }
    }

    @Retention(AnnotationRetention.RUNTIME)
    @Target(AnnotationTarget.FUNCTION)
    annotation class MayProduceNoFrames
}