From 66e78ba57faf5456aa3d017c94e80668477cc0ef Mon Sep 17 00:00:00 2001 From: Yuri Ufimtsev Date: Tue, 19 Mar 2024 16:39:57 +0000 Subject: Make notification tests of Safety Center wait for specific notifications Includes ag/26621194 Bug: 327978990 Test: atest SafetyCenterNotificationTest Relnote: fix Safety Center MTS test Change-Id: I080a5653bf6a8146e80f204a4ef184fcc024e48d LOW_COVERAGE_REASON=Fixing tests, no change in logic --- .../device/SafetyCenterNotificationLoggingHelperTests.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'tests/hostside') diff --git a/tests/hostside/safetycenter/helper-app/src/android/safetycenter/hostside/device/SafetyCenterNotificationLoggingHelperTests.kt b/tests/hostside/safetycenter/helper-app/src/android/safetycenter/hostside/device/SafetyCenterNotificationLoggingHelperTests.kt index dc3cb3fc2..60e6e41ec 100644 --- a/tests/hostside/safetycenter/helper-app/src/android/safetycenter/hostside/device/SafetyCenterNotificationLoggingHelperTests.kt +++ b/tests/hostside/safetycenter/helper-app/src/android/safetycenter/hostside/device/SafetyCenterNotificationLoggingHelperTests.kt @@ -22,6 +22,7 @@ import android.safetycenter.SafetySourceIssue import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4 import com.android.safetycenter.pendingintents.PendingIntentSender +import com.android.safetycenter.testing.NotificationCharacteristics import com.android.safetycenter.testing.SafetyCenterActivityLauncher import com.android.safetycenter.testing.SafetyCenterFlags import com.android.safetycenter.testing.SafetyCenterTestConfigs @@ -74,7 +75,14 @@ class SafetyCenterNotificationLoggingHelperTests { fun openSafetyCenterFromNotification() { safetyCenterTestHelper.setData(SINGLE_SOURCE_ID, newTestDataWithNotifiableIssue()) - sendContentPendingIntent(TestNotificationListener.waitForSingleNotification()) + sendContentPendingIntent( + TestNotificationListener.waitForSingleNotificationMatching( + NotificationCharacteristics( + actions = listOf("See issue"), + safetySourceId = SINGLE_SOURCE_ID, + ) + ) + ) } private fun newTestDataWithNotifiableIssue(): SafetySourceData = -- cgit v1.2.3-59-g8ed1b