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

Commit fec0618c authored by Charles Chen's avatar Charles Chen
Browse files

Introduce FlickerPropertyInitializer

... to wrap properties used in flicker tests

Test: atest
WMShellExplicitFlickerTestsBubbles: EnterBubbleViaBubbleMenuTest
Flag: TEST_ONLY
Bug: 396020056
Change-Id: I1b119cc53045cea5ac3961c2e6ab3b9c733c254e
parent 07b9a20f
Loading
Loading
Loading
Loading
+1 −28
Original line number Diff line number Diff line
@@ -21,14 +21,8 @@ import android.platform.test.annotations.RequiresDevice
import android.platform.test.annotations.RequiresFlagsEnabled
import android.tools.flicker.subject.events.EventLogSubject
import android.tools.traces.component.ComponentNameMatcher
import android.tools.traces.parsers.WindowManagerStateHelper
import android.tools.traces.surfaceflinger.LayerTraceEntry
import android.tools.traces.wm.WindowManagerState
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import com.android.launcher3.tapl.LauncherInstrumentation
import com.android.launcher3.tapl.LauncherInstrumentation.NavigationModel
import com.android.server.wm.flicker.helpers.SimpleAppHelper
import com.android.wm.shell.Flags
import org.junit.ClassRule
import org.junit.FixMethodOrder
@@ -54,28 +48,7 @@ import org.junit.runners.MethodSorters
@Presubmit
class EnterBubbleViaBubbleMenuTest : BubbleFlickerTestBase() {

    companion object {
        private val instrumentation = InstrumentationRegistry.getInstrumentation()

        /**
         * Helper class to wait on [WindowManagerState] or [LayerTraceEntry] conditions.
         *
         * This is also used to wait for transition completes.
         */
        private val wmHelper = WindowManagerStateHelper(
            instrumentation,
            clearCacheAfterParsing = false,
        )

        /**
         * Used for building the scenario.
         */
        private val tapl: LauncherInstrumentation = LauncherInstrumentation()

        /**
         * The app used in scenario.
         */
        private val testApp = SimpleAppHelper(instrumentation)
    companion object : FlickerPropertyInitializer() {

        @ClassRule
        @JvmField
+54 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.wm.shell.flicker.bubbles

import android.app.Instrumentation
import android.tools.traces.parsers.WindowManagerStateHelper
import android.tools.traces.surfaceflinger.LayerTraceEntry
import android.tools.traces.wm.WindowManagerState
import androidx.test.platform.app.InstrumentationRegistry
import com.android.launcher3.tapl.LauncherInstrumentation
import com.android.server.wm.flicker.helpers.SimpleAppHelper

/**
 * A helper class used in `companion object` to initialize essential properties to launch flicker
 * tests.
 */
open class FlickerPropertyInitializer {

    val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()

    /**
     * Helper class to wait on [WindowManagerState] or [LayerTraceEntry] conditions.
     *
     * This is also used to wait for transition completes.
     */
    val wmHelper = WindowManagerStateHelper(
        instrumentation,
        clearCacheAfterParsing = false,
    )

    /**
     * Used for building the scenario.
     */
    val tapl: LauncherInstrumentation = LauncherInstrumentation()

    /**
     * The app used in scenario.
     */
    open val testApp = SimpleAppHelper(instrumentation)
}
 No newline at end of file