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

Commit 7b9ad947 authored by Nataniel Borges's avatar Nataniel Borges
Browse files

Use kotlin lambdas on flicker assertions

This native kotlin mechanism is cleaner than Java's Runnables and Consumers

Test: atest FlickerTests
Change-Id: Iee7c747f3c4c933e8dfe66db4be3f6e11491902f
parent c0254c80
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.server.wm.flicker

import android.util.Log
import androidx.test.InstrumentationRegistry
import androidx.test.filters.LargeTest
import org.junit.FixMethodOrder
import org.junit.Ignore
@@ -40,12 +39,12 @@ class ChangeAppRotationTest(
    endRotation: Int
) : RotationTestBase(beginRotationName, endRotationName, beginRotation, endRotation) {
    init {
        testApp = StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
        testApp = StandardAppHelper(instrumentation,
                "com.android.server.wm.flicker.testapp", "SimpleApp")
    }

    override val transitionToRun: TransitionRunner
        get() = CommonTransitions.changeAppRotation(testApp, uiDevice,
        get() = CommonTransitions.changeAppRotation(testApp, instrumentation, uiDevice,
                beginRotation, endRotation)
                .includeJankyRuns().build()

+2 −3
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.server.wm.flicker

import androidx.test.InstrumentationRegistry
import androidx.test.filters.FlakyTest
import androidx.test.filters.LargeTest
import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper
@@ -39,12 +38,12 @@ class CloseImeAutoOpenWindowToAppTest(
    beginRotation: Int
) : CloseImeWindowToAppTest(beginRotationName, beginRotation) {
    init {
        testApp = ImeAppAutoFocusHelper(InstrumentationRegistry.getInstrumentation())
        testApp = ImeAppAutoFocusHelper(instrumentation)
    }

    override val transitionToRun: TransitionRunner
        get() = CommonTransitions.editTextLoseFocusToApp(testApp as ImeAppAutoFocusHelper,
                uiDevice, beginRotation)
                instrumentation, uiDevice, beginRotation)
                .includeJankyRuns().build()

    @FlakyTest(bugId = 141458352)
+2 −3
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.server.wm.flicker

import androidx.test.InstrumentationRegistry
import androidx.test.filters.FlakyTest
import androidx.test.filters.LargeTest
import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper
@@ -39,12 +38,12 @@ class CloseImeAutoOpenWindowToHomeTest(
    beginRotation: Int
) : CloseImeWindowToHomeTest(beginRotationName, beginRotation) {
    init {
        testApp = ImeAppAutoFocusHelper(InstrumentationRegistry.getInstrumentation())
        testApp = ImeAppAutoFocusHelper(instrumentation)
    }

    override val transitionToRun: TransitionRunner
        get() = CommonTransitions.editTextLoseFocusToHome(testApp as ImeAppAutoFocusHelper,
                uiDevice, beginRotation)
                instrumentation, uiDevice, beginRotation)
                .includeJankyRuns().build()

    @FlakyTest(bugId = 141458352)
+2 −3
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.server.wm.flicker

import androidx.test.InstrumentationRegistry
import androidx.test.filters.LargeTest
import com.android.server.wm.flicker.helpers.ImeAppHelper
import org.junit.FixMethodOrder
@@ -38,12 +37,12 @@ open class CloseImeWindowToAppTest(
    beginRotation: Int
) : NonRotationTestBase(beginRotationName, beginRotation) {
    init {
        testApp = ImeAppHelper(InstrumentationRegistry.getInstrumentation())
        testApp = ImeAppHelper(instrumentation)
    }

    override val transitionToRun: TransitionRunner
        get() = CommonTransitions.editTextLoseFocusToApp(testApp as ImeAppHelper,
                uiDevice, beginRotation)
                instrumentation, uiDevice, beginRotation)
                .includeJankyRuns().build()

    @Ignore("Flaky. Pending debug")
+2 −3
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.server.wm.flicker

import androidx.test.InstrumentationRegistry
import androidx.test.filters.FlakyTest
import androidx.test.filters.LargeTest
import com.android.server.wm.flicker.helpers.ImeAppHelper
@@ -39,12 +38,12 @@ open class CloseImeWindowToHomeTest(
    beginRotation: Int
) : NonRotationTestBase(beginRotationName, beginRotation) {
    init {
        testApp = ImeAppHelper(InstrumentationRegistry.getInstrumentation())
        testApp = ImeAppHelper(instrumentation)
    }

    override val transitionToRun: TransitionRunner
        get() = CommonTransitions.editTextLoseFocusToHome(testApp as ImeAppHelper,
                uiDevice, beginRotation)
                instrumentation, uiDevice, beginRotation)
                .includeJankyRuns().build()

    @Test
Loading