1 /* <lambda>null2 * Copyright (C) 2024 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.wm.shell.flicker.splitscreen 18 19 import android.platform.test.annotations.Presubmit 20 import android.tools.NavBar 21 import android.tools.Rotation 22 import android.tools.ScenarioBuilder 23 import android.tools.flicker.junit.FlickerParametersRunnerFactory 24 import android.tools.flicker.legacy.FlickerBuilder 25 import android.tools.flicker.legacy.LegacyFlickerTest 26 import android.tools.traces.SERVICE_TRACE_CONFIG 27 import android.tools.traces.component.ComponentNameMatcher 28 import androidx.test.filters.RequiresDevice 29 import com.android.wm.shell.flicker.splitscreen.benchmark.MultipleShowImeRequestsInSplitScreenBenchmark 30 import com.android.wm.shell.flicker.utils.ICommonAssertions 31 import org.junit.FixMethodOrder 32 import org.junit.Test 33 import org.junit.runner.RunWith 34 import org.junit.runners.MethodSorters 35 import org.junit.runners.Parameterized 36 37 /** 38 * Test quick switch between two split pairs. 39 * 40 * To run this test: `atest WMShellFlickerTestsSplitScreenGroupOther:MultipleShowImeRequestsInSplitScreen` 41 */ 42 @RequiresDevice 43 @RunWith(Parameterized::class) 44 @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) 45 @FixMethodOrder(MethodSorters.NAME_ASCENDING) 46 class MultipleShowImeRequestsInSplitScreen(override val flicker: LegacyFlickerTest) : 47 MultipleShowImeRequestsInSplitScreenBenchmark(flicker), ICommonAssertions { 48 override val transition: FlickerBuilder.() -> Unit 49 get() = { 50 defaultSetup(this) 51 defaultTeardown(this) 52 thisTransition(this) 53 } 54 55 @Presubmit 56 @Test 57 fun imeLayerAlwaysVisible() = 58 flicker.assertLayers { 59 this.isVisible(ComponentNameMatcher.IME) 60 } 61 62 companion object { 63 private fun createFlickerTest( 64 navBarMode: NavBar 65 ) = LegacyFlickerTest(ScenarioBuilder() 66 .withStartRotation(Rotation.ROTATION_0) 67 .withEndRotation(Rotation.ROTATION_0) 68 .withNavBarMode(navBarMode), resultReaderProvider = { scenario -> 69 android.tools.flicker.datastore.CachedResultReader( 70 scenario, SERVICE_TRACE_CONFIG 71 ) 72 }) 73 74 @Parameterized.Parameters(name = "{0}") 75 @JvmStatic 76 fun getParams() = listOf( 77 createFlickerTest(NavBar.MODE_GESTURAL), 78 createFlickerTest(NavBar.MODE_3BUTTON) 79 ) 80 } 81 }