Loading tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt +37 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.wm.flicker import android.platform.helpers.IAppHelper import com.android.server.wm.flicker.dsl.EventLogAssertion import com.android.server.wm.flicker.dsl.LayersAssertion import com.android.server.wm.flicker.dsl.WmAssertion Loading @@ -24,6 +25,7 @@ import com.android.server.wm.flicker.helpers.WindowUtils const val NAVIGATION_BAR_WINDOW_TITLE = "NavigationBar" const val STATUS_BAR_WINDOW_TITLE = "StatusBar" const val DOCKED_STACK_DIVIDER = "DockedStackDivider" const val WALLPAPER_TITLE = "Wallpaper" @JvmOverloads fun WmAssertion.statusBarWindowIsAlwaysVisible( Loading Loading @@ -54,6 +56,29 @@ fun WmAssertion.visibleWindowsShownMoreThanOneConsecutiveEntry( } } fun WmAssertion.launcherReplacesAppWindowAsTopWindow( testApp: IAppHelper, bugId: Int = 0, enabled: Boolean = bugId == 0 ) { all("launcherReplacesAppWindowAsTopWindow", bugId, enabled) { this.showsAppWindowOnTop(testApp.getPackage()) .then() .showsAppWindowOnTop("Launcher") } } fun WmAssertion.wallpaperWindowBecomesVisible( bugId: Int = 0, enabled: Boolean = bugId == 0 ) { all("wallpaperWindowBecomesVisible", bugId, enabled) { this.hidesBelowAppWindow(WALLPAPER_TITLE) .then() .showsBelowAppWindow(WALLPAPER_TITLE) } } @JvmOverloads fun LayersAssertion.noUncoveredRegions( beginRotation: Int, Loading Loading @@ -177,6 +202,18 @@ fun LayersAssertion.visibleLayersShownMoreThanOneConsecutiveEntry( } } fun LayersAssertion.wallpaperLayerReplacesAppLayer( testApp: IAppHelper, bugId: Int = 0, enabled: Boolean = bugId == 0 ) { all("appLayerReplacesWallpaperLayer", bugId, enabled) { this.showsLayer(testApp.getPackage()) .then() .replaceVisibleLayer(testApp.getPackage(), WALLPAPER_TITLE) } } fun EventLogAssertion.focusChanges( vararg windows: String, bugId: Int = 0, Loading tests/FlickerTests/src/com/android/server/wm/flicker/close/CloseAppBackButtonTest.kt +39 −16 Original line number Diff line number Diff line Loading @@ -20,8 +20,21 @@ import android.view.Surface import androidx.test.filters.RequiresDevice import androidx.test.platform.app.InstrumentationRegistry import com.android.server.wm.flicker.Flicker import com.android.server.wm.flicker.endRotation import com.android.server.wm.flicker.FlickerTestRunnerFactory import com.android.server.wm.flicker.FlickerTestRunner import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible import com.android.server.wm.flicker.launcherReplacesAppWindowAsTopWindow import com.android.server.wm.flicker.wallpaperWindowBecomesVisible import com.android.server.wm.flicker.wallpaperLayerReplacesAppLayer import com.android.server.wm.flicker.noUncoveredRegions import com.android.server.wm.flicker.navBarLayerRotatesAndScales import com.android.server.wm.flicker.statusBarLayerRotatesScales import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen import com.android.server.wm.flicker.helpers.StandardAppHelper import com.android.server.wm.flicker.helpers.buildTestTag Loading @@ -34,22 +47,6 @@ import org.junit.runner.RunWith import org.junit.runners.MethodSorters import org.junit.runners.Parameterized /* * Copyright (C) 2020 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. */ /** * Test app closes by pressing back button * To run this test: `atest FlickerTests:CloseAppBackButtonTest` Loading Loading @@ -93,6 +90,32 @@ class CloseAppBackButtonTest( testApp.exit() } } assertions { windowManagerTrace { navBarWindowIsAlwaysVisible() statusBarWindowIsAlwaysVisible() visibleWindowsShownMoreThanOneConsecutiveEntry() launcherReplacesAppWindowAsTopWindow(testApp) wallpaperWindowBecomesVisible() } layersTrace { noUncoveredRegions(configuration.startRotation, Surface.ROTATION_0, bugId = 141361128) navBarLayerRotatesAndScales(configuration.startRotation, Surface.ROTATION_0) statusBarLayerRotatesScales(configuration.startRotation, Surface.ROTATION_0) navBarLayerIsAlwaysVisible( enabled = Surface.ROTATION_0 == configuration.endRotation) statusBarLayerIsAlwaysVisible( enabled = Surface.ROTATION_0 == configuration.endRotation) visibleLayersShownMoreThanOneConsecutiveEntry() wallpaperLayerReplacesAppLayer(testApp) } } } } } Loading Loading
tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt +37 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.wm.flicker import android.platform.helpers.IAppHelper import com.android.server.wm.flicker.dsl.EventLogAssertion import com.android.server.wm.flicker.dsl.LayersAssertion import com.android.server.wm.flicker.dsl.WmAssertion Loading @@ -24,6 +25,7 @@ import com.android.server.wm.flicker.helpers.WindowUtils const val NAVIGATION_BAR_WINDOW_TITLE = "NavigationBar" const val STATUS_BAR_WINDOW_TITLE = "StatusBar" const val DOCKED_STACK_DIVIDER = "DockedStackDivider" const val WALLPAPER_TITLE = "Wallpaper" @JvmOverloads fun WmAssertion.statusBarWindowIsAlwaysVisible( Loading Loading @@ -54,6 +56,29 @@ fun WmAssertion.visibleWindowsShownMoreThanOneConsecutiveEntry( } } fun WmAssertion.launcherReplacesAppWindowAsTopWindow( testApp: IAppHelper, bugId: Int = 0, enabled: Boolean = bugId == 0 ) { all("launcherReplacesAppWindowAsTopWindow", bugId, enabled) { this.showsAppWindowOnTop(testApp.getPackage()) .then() .showsAppWindowOnTop("Launcher") } } fun WmAssertion.wallpaperWindowBecomesVisible( bugId: Int = 0, enabled: Boolean = bugId == 0 ) { all("wallpaperWindowBecomesVisible", bugId, enabled) { this.hidesBelowAppWindow(WALLPAPER_TITLE) .then() .showsBelowAppWindow(WALLPAPER_TITLE) } } @JvmOverloads fun LayersAssertion.noUncoveredRegions( beginRotation: Int, Loading Loading @@ -177,6 +202,18 @@ fun LayersAssertion.visibleLayersShownMoreThanOneConsecutiveEntry( } } fun LayersAssertion.wallpaperLayerReplacesAppLayer( testApp: IAppHelper, bugId: Int = 0, enabled: Boolean = bugId == 0 ) { all("appLayerReplacesWallpaperLayer", bugId, enabled) { this.showsLayer(testApp.getPackage()) .then() .replaceVisibleLayer(testApp.getPackage(), WALLPAPER_TITLE) } } fun EventLogAssertion.focusChanges( vararg windows: String, bugId: Int = 0, Loading
tests/FlickerTests/src/com/android/server/wm/flicker/close/CloseAppBackButtonTest.kt +39 −16 Original line number Diff line number Diff line Loading @@ -20,8 +20,21 @@ import android.view.Surface import androidx.test.filters.RequiresDevice import androidx.test.platform.app.InstrumentationRegistry import com.android.server.wm.flicker.Flicker import com.android.server.wm.flicker.endRotation import com.android.server.wm.flicker.FlickerTestRunnerFactory import com.android.server.wm.flicker.FlickerTestRunner import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible import com.android.server.wm.flicker.launcherReplacesAppWindowAsTopWindow import com.android.server.wm.flicker.wallpaperWindowBecomesVisible import com.android.server.wm.flicker.wallpaperLayerReplacesAppLayer import com.android.server.wm.flicker.noUncoveredRegions import com.android.server.wm.flicker.navBarLayerRotatesAndScales import com.android.server.wm.flicker.statusBarLayerRotatesScales import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen import com.android.server.wm.flicker.helpers.StandardAppHelper import com.android.server.wm.flicker.helpers.buildTestTag Loading @@ -34,22 +47,6 @@ import org.junit.runner.RunWith import org.junit.runners.MethodSorters import org.junit.runners.Parameterized /* * Copyright (C) 2020 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. */ /** * Test app closes by pressing back button * To run this test: `atest FlickerTests:CloseAppBackButtonTest` Loading Loading @@ -93,6 +90,32 @@ class CloseAppBackButtonTest( testApp.exit() } } assertions { windowManagerTrace { navBarWindowIsAlwaysVisible() statusBarWindowIsAlwaysVisible() visibleWindowsShownMoreThanOneConsecutiveEntry() launcherReplacesAppWindowAsTopWindow(testApp) wallpaperWindowBecomesVisible() } layersTrace { noUncoveredRegions(configuration.startRotation, Surface.ROTATION_0, bugId = 141361128) navBarLayerRotatesAndScales(configuration.startRotation, Surface.ROTATION_0) statusBarLayerRotatesScales(configuration.startRotation, Surface.ROTATION_0) navBarLayerIsAlwaysVisible( enabled = Surface.ROTATION_0 == configuration.endRotation) statusBarLayerIsAlwaysVisible( enabled = Surface.ROTATION_0 == configuration.endRotation) visibleLayersShownMoreThanOneConsecutiveEntry() wallpaperLayerReplacesAppLayer(testApp) } } } } } Loading