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

Commit 618e9944 authored by Ikram Gabiyev's avatar Ikram Gabiyev
Browse files

[PiP2] Assert for layer expand in flicker test

Add an assertion to ExitPipToAppViaIntentTest that checks
whether PiP layer expands with each trace.

Do this by creating a new LayerExpands AssertionTemplateWithComponent
class that can be reused for other PiP FaaS tests later.

Bug: 430819835
Flag: com.android.wm.shell.enable_pip2
Test: atest WMShellFlickerServicePipTests:ExitPipToAppViaIntentTest
Change-Id: Ife51b937cce95231ee1269df59fa2befb0cb6471
parent 02285f10
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -17,12 +17,14 @@
package com.android.wm.shell.flicker

import android.app.Instrumentation
import androidx.test.filters.RequiresDevice
import android.tools.NavBar
import android.tools.Rotation
import android.tools.flicker.AssertionInvocationGroup
import android.tools.flicker.FlickerConfig
import android.tools.flicker.annotation.ExpectedScenarios
import android.tools.flicker.annotation.FlickerConfigProvider
import android.tools.flicker.assertors.ComponentTemplate
import android.tools.flicker.assertors.assertions.LayerExpands
import android.tools.flicker.config.AssertionTemplates
import android.tools.flicker.config.FlickerConfig
import android.tools.flicker.config.FlickerConfigEntry
@@ -32,6 +34,7 @@ import android.tools.flicker.extractors.TaggedScenarioExtractorBuilder
import android.tools.flicker.junit.FlickerServiceJUnit4ClassRunner
import android.tools.traces.events.CujType
import android.tools.traces.parsers.WindowManagerStateHelper
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.helpers.PipAppHelper
import com.android.server.wm.flicker.testapp.ActivityOptions
@@ -56,10 +59,6 @@ import org.junit.runner.RunWith
@RequiresDevice
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class ExitPipToAppViaIntentTest {
    val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
    val wmHelper = WindowManagerStateHelper(instrumentation)
    val pipApp: PipAppHelper = PipAppHelper(instrumentation)

    @Rule
    @JvmField
    val testSetupRule = Utils.testSetupRule(NavBar.MODE_GESTURAL, Rotation.ROTATION_0)
@@ -84,15 +83,23 @@ class ExitPipToAppViaIntentTest {
    }

    companion object {
        val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
        val wmHelper = WindowManagerStateHelper(instrumentation)
        val pipApp: PipAppHelper = PipAppHelper(instrumentation)
        private val pipAppComponentTemplate = ComponentTemplate("PIP_APP") { _ -> pipApp }

        private val PIP_EXPAND_CUJ_EXTRACTOR = TaggedScenarioExtractorBuilder()
                .setTargetTag(CujType.CUJ_PIP_TRANSITION)
                .setAdditionalCujFilter {
                    it.tag == "EXIT_PIP"
                }.build()

        private val PIP_EXPAND_CUJ_CONFIG = FlickerConfigEntry(
                scenarioId = ScenarioId("PIP_EXPAND_TO_FULLSCREEN"),
                extractor = PIP_EXPAND_CUJ_EXTRACTOR,
                assertions = AssertionTemplates.COMMON_ASSERTIONS,
                assertions = AssertionTemplates.COMMON_ASSERTIONS + mapOf(
                    LayerExpands(pipAppComponentTemplate) to AssertionInvocationGroup.BLOCKING
                ),
                enabled = true
        )