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