Merge "Split notification and app launch tests in different modules" into udc-qpr-dev

This commit is contained in:
Nataniel Borges
2023-06-23 14:48:08 +00:00
committed by Android (Google) Code Review
12 changed files with 203 additions and 17 deletions

View File

@@ -15,6 +15,7 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.android.wm.shell.flicker">
<uses-sdk android:minSdkVersion="29" android:targetSdkVersion="29"/>
@@ -57,10 +58,11 @@
<action android:name="android.service.notification.NotificationListenerService" />
</intent-filter>
</service>
</application>
<instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.wm.shell.flicker"
android:label="WindowManager Shell Flicker Tests">
</instrumentation>
<!-- (b/197936012) Remove startup provider due to test timeout issue -->
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove" />
</application>
</manifest>

View File

@@ -52,6 +52,11 @@ filegroup {
srcs: ["src/**/launch/*.kt"],
}
filegroup {
name: "FlickerTestsNotification-src",
srcs: ["src/**/notification/*.kt"],
}
filegroup {
name: "FlickerTestsQuickswitch-src",
srcs: ["src/**/quickswitch/*.kt"],
@@ -145,6 +150,18 @@ android_test {
],
}
android_test {
name: "FlickerTestsNotification",
defaults: ["FlickerTestsDefault"],
additional_manifests: ["manifests/AndroidManifestNotification.xml"],
package_name: "com.android.server.wm.flicker.notification",
instrumentation_target_package: "com.android.server.wm.flicker.notification",
srcs: [
":FlickerTestsBase-src",
":FlickerTestsNotification-src",
],
}
android_test {
name: "FlickerTestsQuickswitch",
defaults: ["FlickerTestsDefault"],

View File

@@ -16,6 +16,7 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.android.server.wm.flicker">
<uses-sdk android:minSdkVersion="29" android:targetSdkVersion="29"/>
@@ -47,5 +48,11 @@
<application android:requestLegacyExternalStorage="true" android:largeHeap="true">
<uses-library android:name="android.test.runner"/>
<uses-library android:name="androidx.window.extensions" android:required="false"/>
<!-- (b/197936012) Remove startup provider due to test timeout issue -->
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove" />
</application>
</manifest>

View File

@@ -0,0 +1,24 @@
<!--
~ Copyright (C) 2023 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.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.server.wm.flicker.close">
<instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.server.wm.flicker.notification"
android:label="WindowManager Flicker Tests">
</instrumentation>
</manifest>

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 The Android Open Source Project
* Copyright (C) 2023 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.server.wm.flicker.launch
package com.android.server.wm.flicker.notification
import android.platform.test.annotations.Postsubmit
import android.platform.test.rule.SettingOverrideRule

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 The Android Open Source Project
* Copyright (C) 2023 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.server.wm.flicker.launch
package com.android.server.wm.flicker.notification
import android.platform.test.annotations.FlakyTest
import android.platform.test.annotations.Presubmit

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 The Android Open Source Project
* Copyright (C) 2023 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.server.wm.flicker.launch
package com.android.server.wm.flicker.notification
import android.platform.test.annotations.FlakyTest
import android.platform.test.annotations.Postsubmit

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 The Android Open Source Project
* Copyright (C) 2023 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.server.wm.flicker.launch
package com.android.server.wm.flicker.notification
import android.platform.test.annotations.Postsubmit
import android.platform.test.annotations.Presubmit

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.server.wm.flicker.launch
package com.android.server.wm.flicker.notification
import android.platform.test.annotations.Postsubmit
import android.tools.device.flicker.junit.FlickerParametersRunnerFactory

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 The Android Open Source Project
* Copyright (C) 2023 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.server.wm.flicker.launch
package com.android.server.wm.flicker.notification
import android.platform.test.annotations.Postsubmit
import android.platform.test.annotations.Presubmit

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.server.wm.flicker.launch
package com.android.server.wm.flicker.notification
import android.tools.device.flicker.junit.FlickerParametersRunnerFactory
import android.tools.device.flicker.legacy.LegacyFlickerTest

View File

@@ -0,0 +1,136 @@
/*
* Copyright (C) 2021 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.server.wm.flicker.notification
import android.platform.test.annotations.Presubmit
import android.tools.common.traces.component.ComponentNameMatcher
import android.tools.device.apphelpers.StandardAppHelper
import android.tools.device.flicker.legacy.FlickerBuilder
import android.tools.device.flicker.legacy.LegacyFlickerTest
import android.tools.device.helpers.wakeUpAndGoToHomeScreen
import com.android.server.wm.flicker.BaseTest
import com.android.server.wm.flicker.helpers.SimpleAppHelper
import com.android.server.wm.flicker.helpers.setRotation
import org.junit.Test
/** Base class for app launch tests */
abstract class OpenAppTransition(flicker: LegacyFlickerTest) : BaseTest(flicker) {
protected open val testApp: StandardAppHelper = SimpleAppHelper(instrumentation)
/** {@inheritDoc} */
override val transition: FlickerBuilder.() -> Unit = {
setup {
tapl.setExpectedRotation(flicker.scenario.startRotation.value)
device.wakeUpAndGoToHomeScreen()
this.setRotation(flicker.scenario.startRotation)
}
teardown { testApp.exit(wmHelper) }
}
/**
* Checks that the [testApp] layer doesn't exist or is invisible at the start of the transition,
* but is created and/or becomes visible during the transition.
*/
@Presubmit
@Test
open fun appLayerBecomesVisible() {
appLayerBecomesVisible_coldStart()
}
protected fun appLayerBecomesVisible_coldStart() {
flicker.assertLayers {
this.notContains(testApp)
.then()
.isInvisible(testApp, isOptional = true)
.then()
.isVisible(ComponentNameMatcher.SNAPSHOT, isOptional = true)
.then()
.isVisible(ComponentNameMatcher.SPLASH_SCREEN, isOptional = true)
.then()
.isVisible(testApp)
}
}
protected fun appLayerBecomesVisible_warmStart() {
flicker.assertLayers {
this.isInvisible(testApp)
.then()
.isVisible(ComponentNameMatcher.SNAPSHOT, isOptional = true)
.then()
.isVisible(ComponentNameMatcher.SPLASH_SCREEN, isOptional = true)
.then()
.isVisible(testApp)
}
}
/**
* Checks that the [testApp] window doesn't exist at the start of the transition, that it is
* created (invisible - optional) and becomes visible during the transition
*
* The `isAppWindowInvisible` step is optional because we log once per frame, upon logging, the
* window may be visible or not depending on what was processed until that moment.
*/
@Presubmit @Test open fun appWindowBecomesVisible() = appWindowBecomesVisible_coldStart()
protected fun appWindowBecomesVisible_coldStart() {
flicker.assertWm {
this.notContains(testApp)
.then()
.isAppWindowInvisible(testApp, isOptional = true)
.then()
.isAppWindowVisible(testApp)
}
}
protected fun appWindowBecomesVisible_warmStart() {
flicker.assertWm {
this.isAppWindowInvisible(testApp)
.then()
.isAppWindowVisible(ComponentNameMatcher.SNAPSHOT, isOptional = true)
.then()
.isAppWindowVisible(ComponentNameMatcher.SPLASH_SCREEN, isOptional = true)
.then()
.isAppWindowVisible(testApp)
}
}
/**
* Checks that [testApp] window is not on top at the start of the transition, and then becomes
* the top visible window until the end of the transition.
*/
@Presubmit
@Test
open fun appWindowBecomesTopWindow() {
flicker.assertWm {
this.isAppWindowNotOnTop(testApp)
.then()
.isAppWindowOnTop(
testApp.or(ComponentNameMatcher.SNAPSHOT).or(ComponentNameMatcher.SPLASH_SCREEN)
)
}
}
/**
* Checks that [testApp] window is not on top at the start of the transition, and then becomes
* the top visible window until the end of the transition.
*/
@Presubmit
@Test
open fun appWindowIsTopWindowAtEnd() {
flicker.assertWmEnd { this.isAppWindowOnTop(testApp) }
}
}