1 /* 2 * Copyright (C) 2020 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.pip 18 19 import android.platform.test.annotations.RequiresFlagsDisabled 20 import android.tools.flicker.junit.FlickerParametersRunnerFactory 21 import android.tools.flicker.legacy.FlickerBuilder 22 import android.tools.flicker.legacy.LegacyFlickerTest 23 import com.android.server.wm.flicker.helpers.PipAppHelper 24 import com.android.wm.shell.Flags 25 import com.android.wm.shell.flicker.pip.common.ExitPipToAppTransition 26 import org.junit.FixMethodOrder 27 import org.junit.runner.RunWith 28 import org.junit.runners.MethodSorters 29 import org.junit.runners.Parameterized 30 31 /** 32 * Test expanding a pip window back to full screen via an intent 33 * 34 * To run this test: `atest WMShellFlickerTestsPip:ExitPipToAppViaIntentTest` 35 * 36 * Actions: 37 * ``` 38 * Launch an app in pip mode [pipApp], 39 * Launch another full screen mode [testApp] 40 * Expand [pipApp] app to full screen via an intent 41 * ``` 42 * 43 * Notes: 44 * ``` 45 * 1. Some default assertions (e.g., nav bar, status bar and screen covered) 46 * are inherited from [PipTransition] 47 * 2. Part of the test setup occurs automatically via 48 * [android.tools.flicker.legacy.runner.TransitionRunner], 49 * including configuring navigation mode, initial orientation and ensuring no 50 * apps are running before setup 51 * ``` 52 */ 53 @RunWith(Parameterized::class) 54 @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) 55 @FixMethodOrder(MethodSorters.NAME_ASCENDING) 56 @RequiresFlagsDisabled(Flags.FLAG_ENABLE_PIP2) 57 class ExitPipToAppViaIntentTest(flicker: LegacyFlickerTest) : ExitPipToAppTransition(flicker) { 58 override val pipApp: PipAppHelper = PipAppHelper(instrumentation) 59 <lambda>null60 override val thisTransition: FlickerBuilder.() -> Unit = { 61 setup { 62 // launch an app behind the pip one 63 testApp.launchViaIntent(wmHelper) 64 } 65 transitions { 66 // This will bring PipApp to fullscreen 67 pipApp.exitPipToFullScreenViaIntent(wmHelper) 68 // Wait until the other app is no longer visible 69 wmHelper.StateSyncBuilder().withWindowSurfaceDisappeared(testApp).waitForAndVerify() 70 } 71 } 72 } 73