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

Commit 695d34d0 authored by Saho Kobayashi's avatar Saho Kobayashi
Browse files

Inherit TestScenarioBase so that the screen is recorded

Bug: 431703947
Bug: 429545827
Bug: 431781366
Test: atest OpenAndFocusTest
Test: atest MoveToNextDisplayAndFocusTest
Test: atest CloseThenMoveFocusTest
Test: atest DragAndFocusTest
Test: atest ClickAndFocusTest
Flag: EXEMPT test clean up
Change-Id: I991e5bd79039e5360a109aba79666570ad2d4e6e
parent 12ce9ef3
Loading
Loading
Loading
Loading
+4 −9
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@
package com.android.wm.shell.scenarios

import android.platform.test.annotations.EnableFlags
import android.tools.PlatformConsts.DEFAULT_DISPLAY
import android.tools.traces.parsers.WindowManagerStateHelper
import android.view.KeyEvent.KEYCODE_MINUS
import android.view.KeyEvent.META_META_ON
@@ -27,8 +26,8 @@ import com.android.server.wm.flicker.helpers.KeyEventHelper
import com.android.server.wm.flicker.helpers.MailAppHelper
import com.android.server.wm.flicker.helpers.SimpleAppHelper
import com.android.window.flags.Flags
import com.android.wm.shell.shared.desktopmode.DesktopState
import org.junit.After import org.junit.Assume import org.junit.Before
import org.junit.After
import org.junit.Before
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
@@ -42,10 +41,10 @@ import platform.test.desktop.SimulatedConnectedDisplayTestRule
@EnableFlags(
    Flags.FLAG_ENABLE_DISPLAY_FOCUS_IN_SHELL_TRANSITIONS,
)
abstract class ClickAndFocus() {
abstract class ClickAndFocus() : TestScenarioBase() {
    private val wmHelper = WindowManagerStateHelper(getInstrumentation())

    private val device = UiDevice.getInstance(getInstrumentation())

    private val testAppInMainDisplay = DesktopModeAppHelper(SimpleAppHelper(getInstrumentation()))
    private val testAppInExternalDisplay =
            DesktopModeAppHelper(MailAppHelper(getInstrumentation()))
@@ -56,10 +55,6 @@ abstract class ClickAndFocus() {
    @Before
    fun setup() {
        connectedDisplayRule.setupTestDisplay()
        Assume.assumeTrue(
            DesktopState.fromContext(getInstrumentation().context)
                .isDesktopModeSupportedOnDisplay(DEFAULT_DISPLAY)
        )
        // TODO(b/426420246): Use launchViaIntentOnDisplay
        testAppInExternalDisplay.launchViaIntent(wmHelper)
        testAppInExternalDisplay.moveToNextDisplayViaKeyboard(
+2 −9
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.wm.shell.scenarios

import android.platform.test.annotations.EnableFlags
import android.tools.PlatformConsts.DEFAULT_DISPLAY
import android.tools.traces.parsers.WindowManagerStateHelper
import android.view.KeyEvent.KEYCODE_MINUS
import android.view.KeyEvent.META_META_ON
@@ -28,9 +27,7 @@ import com.android.server.wm.flicker.helpers.KeyEventHelper
import com.android.server.wm.flicker.helpers.MailAppHelper
import com.android.server.wm.flicker.helpers.SimpleAppHelper
import com.android.window.flags.Flags
import com.android.wm.shell.shared.desktopmode.DesktopState
import org.junit.After
import org.junit.Assume
import org.junit.Before
import org.junit.Ignore
import org.junit.Rule
@@ -46,10 +43,10 @@ import platform.test.desktop.SimulatedConnectedDisplayTestRule
@EnableFlags(
    Flags.FLAG_ENABLE_DISPLAY_FOCUS_IN_SHELL_TRANSITIONS,
)
abstract class CloseThenMoveFocus() {
abstract class CloseThenMoveFocus() : TestScenarioBase() {
    private val wmHelper = WindowManagerStateHelper(getInstrumentation())

    private val device = UiDevice.getInstance(getInstrumentation())

    private val testAppInMainDisplay = DesktopModeAppHelper(SimpleAppHelper(getInstrumentation()))
    private val testAppInExternalDisplay =
            DesktopModeAppHelper(MailAppHelper(getInstrumentation()))
@@ -60,10 +57,6 @@ abstract class CloseThenMoveFocus() {
    @Before
    fun setup() {
        connectedDisplayRule.setupTestDisplay()
        Assume.assumeTrue(
            DesktopState.fromContext(getInstrumentation().context)
                .isDesktopModeSupportedOnDisplay(DEFAULT_DISPLAY)
        )
        testAppInMainDisplay.enterDesktopMode(wmHelper, device)
        // TODO(b/426420246): Use launchViaIntentOnDisplay
        testAppInExternalDisplay.launchViaIntent(wmHelper)
+2 −8
Original line number Diff line number Diff line
@@ -31,9 +31,7 @@ import com.android.server.wm.flicker.helpers.KeyEventHelper
import com.android.server.wm.flicker.helpers.MailAppHelper
import com.android.server.wm.flicker.helpers.SimpleAppHelper
import com.android.window.flags.Flags
import com.android.wm.shell.shared.desktopmode.DesktopState
import org.junit.After
import org.junit.Assume
import org.junit.Before
import org.junit.Ignore
import org.junit.Rule
@@ -49,10 +47,10 @@ import platform.test.desktop.SimulatedConnectedDisplayTestRule
@EnableFlags(
    Flags.FLAG_ENABLE_DISPLAY_FOCUS_IN_SHELL_TRANSITIONS,
)
abstract class DragAndKeepFocus() {
abstract class DragAndKeepFocus() : TestScenarioBase() {
    private val wmHelper = WindowManagerStateHelper(getInstrumentation())

    private val device = UiDevice.getInstance(getInstrumentation())

    private val testAppInMainDisplay = DesktopModeAppHelper(SimpleAppHelper(getInstrumentation()))
    private val testAppInExternalDisplay =
            DesktopModeAppHelper(MailAppHelper(getInstrumentation()))
@@ -66,10 +64,6 @@ abstract class DragAndKeepFocus() {
    @Before
    fun setup() {
        connectedDisplayRule.setupTestDisplay()
        Assume.assumeTrue(
            DesktopState.fromContext(getInstrumentation().context)
                .isDesktopModeSupportedOnDisplay(DEFAULT_DISPLAY)
        )
        testAppInMainDisplay.launchViaIntent(wmHelper)
        testAppInExternalDisplay.launchViaIntent(wmHelper)
    }
+2 −9
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.wm.shell.scenarios

import android.platform.test.annotations.EnableFlags
import android.tools.PlatformConsts.DEFAULT_DISPLAY
import android.tools.traces.parsers.WindowManagerStateHelper
import android.view.KeyEvent.KEYCODE_MINUS
import android.view.KeyEvent.META_META_ON
@@ -28,9 +27,7 @@ import com.android.server.wm.flicker.helpers.KeyEventHelper
import com.android.server.wm.flicker.helpers.MailAppHelper
import com.android.server.wm.flicker.helpers.SimpleAppHelper
import com.android.window.flags.Flags
import com.android.wm.shell.shared.desktopmode.DesktopState
import org.junit.After
import org.junit.Assume
import org.junit.Before
import org.junit.Ignore
import org.junit.Rule
@@ -45,10 +42,10 @@ import platform.test.desktop.SimulatedConnectedDisplayTestRule
@EnableFlags(
    Flags.FLAG_ENABLE_DISPLAY_FOCUS_IN_SHELL_TRANSITIONS,
)
abstract class MoveToNextDisplayAndFocus() {
abstract class MoveToNextDisplayAndFocus() : TestScenarioBase() {
    private val wmHelper = WindowManagerStateHelper(getInstrumentation())

    private val device = UiDevice.getInstance(getInstrumentation())

    private val testAppInMainDisplay = DesktopModeAppHelper(SimpleAppHelper(getInstrumentation()))
    private val testAppInExternalDisplay =
            DesktopModeAppHelper(MailAppHelper(getInstrumentation()))
@@ -59,10 +56,6 @@ abstract class MoveToNextDisplayAndFocus() {
    @Before
    fun setup() {
        connectedDisplayRule.setupTestDisplay()
        Assume.assumeTrue(
            DesktopState.fromContext(getInstrumentation().context)
                .isDesktopModeSupportedOnDisplay(DEFAULT_DISPLAY)
        )
        testAppInMainDisplay.launchViaIntent(wmHelper)
        testAppInExternalDisplay.launchViaIntent(wmHelper)
    }
+2 −9
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.wm.shell.scenarios

import android.platform.test.annotations.EnableFlags
import android.tools.PlatformConsts.DEFAULT_DISPLAY
import android.tools.traces.parsers.WindowManagerStateHelper
import android.view.KeyEvent.KEYCODE_MINUS
import android.view.KeyEvent.META_META_ON
@@ -28,9 +27,7 @@ import com.android.server.wm.flicker.helpers.KeyEventHelper
import com.android.server.wm.flicker.helpers.MailAppHelper
import com.android.server.wm.flicker.helpers.SimpleAppHelper
import com.android.window.flags.Flags
import com.android.wm.shell.shared.desktopmode.DesktopState
import org.junit.After
import org.junit.Assume
import org.junit.Before
import org.junit.Ignore
import org.junit.Rule
@@ -45,10 +42,10 @@ import platform.test.desktop.SimulatedConnectedDisplayTestRule
@EnableFlags(
    Flags.FLAG_ENABLE_DISPLAY_FOCUS_IN_SHELL_TRANSITIONS,
)
abstract class OpenAndFocus() {
abstract class OpenAndFocus() : TestScenarioBase() {
    private val wmHelper = WindowManagerStateHelper(getInstrumentation())

    private val device = UiDevice.getInstance(getInstrumentation())

    private val testAppInMainDisplay = DesktopModeAppHelper(SimpleAppHelper(getInstrumentation()))
    private val testAppInExternalDisplay =
            DesktopModeAppHelper(MailAppHelper(getInstrumentation()))
@@ -59,10 +56,6 @@ abstract class OpenAndFocus() {
    @Before
    fun setup() {
        connectedDisplayRule.setupTestDisplay()
        Assume.assumeTrue(
            DesktopState.fromContext(getInstrumentation().context)
                .isDesktopModeSupportedOnDisplay(DEFAULT_DISPLAY)
        )
        testAppInMainDisplay.launchViaIntent(wmHelper)
    }