Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestBase.kt +39 −24 Original line number Diff line number Diff line Loading @@ -217,30 +217,32 @@ abstract class VisualInterruptionDecisionProviderTestBase : SysuiTestCase() { @Test fun testShouldPeek_defaultLegacySuppressor() { ensurePeekState() provider.addLegacySuppressor(neverSuppresses) assertShouldHeadsUp(buildPeekEntry()) withLegacySuppressor(neverSuppresses) { assertShouldHeadsUp(buildPeekEntry()) } } @Test fun testShouldNotPeek_legacySuppressInterruptions() { ensurePeekState() provider.addLegacySuppressor(alwaysSuppressesInterruptions) withLegacySuppressor(alwaysSuppressesInterruptions) { assertShouldNotHeadsUp(buildPeekEntry()) } } @Test fun testShouldNotPeek_legacySuppressAwakeInterruptions() { ensurePeekState() provider.addLegacySuppressor(alwaysSuppressesAwakeInterruptions) withLegacySuppressor(alwaysSuppressesAwakeInterruptions) { assertShouldNotHeadsUp(buildPeekEntry()) } } @Test fun testShouldNotPeek_legacySuppressAwakeHeadsUp() { ensurePeekState() provider.addLegacySuppressor(alwaysSuppressesAwakeHeadsUp) withLegacySuppressor(alwaysSuppressesAwakeHeadsUp) { assertShouldNotHeadsUp(buildPeekEntry()) } } @Test fun testShouldPulse() { Loading @@ -251,30 +253,32 @@ abstract class VisualInterruptionDecisionProviderTestBase : SysuiTestCase() { @Test fun testShouldPulse_defaultLegacySuppressor() { ensurePulseState() provider.addLegacySuppressor(neverSuppresses) assertShouldHeadsUp(buildPulseEntry()) withLegacySuppressor(neverSuppresses) { assertShouldHeadsUp(buildPulseEntry()) } } @Test fun testShouldNotPulse_legacySuppressInterruptions() { ensurePulseState() provider.addLegacySuppressor(alwaysSuppressesInterruptions) withLegacySuppressor(alwaysSuppressesInterruptions) { assertShouldNotHeadsUp(buildPulseEntry()) } } @Test fun testShouldPulse_legacySuppressAwakeInterruptions() { ensurePulseState() provider.addLegacySuppressor(alwaysSuppressesAwakeInterruptions) withLegacySuppressor(alwaysSuppressesAwakeInterruptions) { assertShouldHeadsUp(buildPulseEntry()) } } @Test fun testShouldPulse_legacySuppressAwakeHeadsUp() { ensurePulseState() provider.addLegacySuppressor(alwaysSuppressesAwakeHeadsUp) withLegacySuppressor(alwaysSuppressesAwakeHeadsUp) { assertShouldHeadsUp(buildPulseEntry()) } } @Test fun testShouldNotPulse_disabled() { Loading Loading @@ -439,30 +443,32 @@ abstract class VisualInterruptionDecisionProviderTestBase : SysuiTestCase() { @Test fun testShouldBubble_defaultLegacySuppressor() { ensureBubbleState() provider.addLegacySuppressor(neverSuppresses) assertShouldBubble(buildBubbleEntry()) withLegacySuppressor(neverSuppresses) { assertShouldBubble(buildBubbleEntry()) } } @Test fun testShouldNotBubble_legacySuppressInterruptions() { ensureBubbleState() provider.addLegacySuppressor(alwaysSuppressesInterruptions) withLegacySuppressor(alwaysSuppressesInterruptions) { assertShouldNotBubble(buildBubbleEntry()) } } @Test fun testShouldNotBubble_legacySuppressAwakeInterruptions() { ensureBubbleState() provider.addLegacySuppressor(alwaysSuppressesAwakeInterruptions) withLegacySuppressor(alwaysSuppressesAwakeInterruptions) { assertShouldNotBubble(buildBubbleEntry()) } } @Test fun testShouldBubble_legacySuppressAwakeHeadsUp() { ensureBubbleState() provider.addLegacySuppressor(alwaysSuppressesAwakeHeadsUp) withLegacySuppressor(alwaysSuppressesAwakeHeadsUp) { assertShouldBubble(buildBubbleEntry()) } } @Test fun testShouldNotAlert_hiddenOnKeyguard() { Loading Loading @@ -585,6 +591,15 @@ abstract class VisualInterruptionDecisionProviderTestBase : SysuiTestCase() { run(block) } protected fun withLegacySuppressor( suppressor: NotificationInterruptSuppressor, block: () -> Unit ) { provider.addLegacySuppressor(suppressor) block() provider.removeLegacySuppressor(suppressor) } protected fun assertShouldHeadsUp(entry: NotificationEntry) = provider.makeUnloggedHeadsUpDecision(entry).let { assertTrue("unexpected suppressed HUN: ${it.logReason}", it.shouldInterrupt) Loading Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestBase.kt +39 −24 Original line number Diff line number Diff line Loading @@ -217,30 +217,32 @@ abstract class VisualInterruptionDecisionProviderTestBase : SysuiTestCase() { @Test fun testShouldPeek_defaultLegacySuppressor() { ensurePeekState() provider.addLegacySuppressor(neverSuppresses) assertShouldHeadsUp(buildPeekEntry()) withLegacySuppressor(neverSuppresses) { assertShouldHeadsUp(buildPeekEntry()) } } @Test fun testShouldNotPeek_legacySuppressInterruptions() { ensurePeekState() provider.addLegacySuppressor(alwaysSuppressesInterruptions) withLegacySuppressor(alwaysSuppressesInterruptions) { assertShouldNotHeadsUp(buildPeekEntry()) } } @Test fun testShouldNotPeek_legacySuppressAwakeInterruptions() { ensurePeekState() provider.addLegacySuppressor(alwaysSuppressesAwakeInterruptions) withLegacySuppressor(alwaysSuppressesAwakeInterruptions) { assertShouldNotHeadsUp(buildPeekEntry()) } } @Test fun testShouldNotPeek_legacySuppressAwakeHeadsUp() { ensurePeekState() provider.addLegacySuppressor(alwaysSuppressesAwakeHeadsUp) withLegacySuppressor(alwaysSuppressesAwakeHeadsUp) { assertShouldNotHeadsUp(buildPeekEntry()) } } @Test fun testShouldPulse() { Loading @@ -251,30 +253,32 @@ abstract class VisualInterruptionDecisionProviderTestBase : SysuiTestCase() { @Test fun testShouldPulse_defaultLegacySuppressor() { ensurePulseState() provider.addLegacySuppressor(neverSuppresses) assertShouldHeadsUp(buildPulseEntry()) withLegacySuppressor(neverSuppresses) { assertShouldHeadsUp(buildPulseEntry()) } } @Test fun testShouldNotPulse_legacySuppressInterruptions() { ensurePulseState() provider.addLegacySuppressor(alwaysSuppressesInterruptions) withLegacySuppressor(alwaysSuppressesInterruptions) { assertShouldNotHeadsUp(buildPulseEntry()) } } @Test fun testShouldPulse_legacySuppressAwakeInterruptions() { ensurePulseState() provider.addLegacySuppressor(alwaysSuppressesAwakeInterruptions) withLegacySuppressor(alwaysSuppressesAwakeInterruptions) { assertShouldHeadsUp(buildPulseEntry()) } } @Test fun testShouldPulse_legacySuppressAwakeHeadsUp() { ensurePulseState() provider.addLegacySuppressor(alwaysSuppressesAwakeHeadsUp) withLegacySuppressor(alwaysSuppressesAwakeHeadsUp) { assertShouldHeadsUp(buildPulseEntry()) } } @Test fun testShouldNotPulse_disabled() { Loading Loading @@ -439,30 +443,32 @@ abstract class VisualInterruptionDecisionProviderTestBase : SysuiTestCase() { @Test fun testShouldBubble_defaultLegacySuppressor() { ensureBubbleState() provider.addLegacySuppressor(neverSuppresses) assertShouldBubble(buildBubbleEntry()) withLegacySuppressor(neverSuppresses) { assertShouldBubble(buildBubbleEntry()) } } @Test fun testShouldNotBubble_legacySuppressInterruptions() { ensureBubbleState() provider.addLegacySuppressor(alwaysSuppressesInterruptions) withLegacySuppressor(alwaysSuppressesInterruptions) { assertShouldNotBubble(buildBubbleEntry()) } } @Test fun testShouldNotBubble_legacySuppressAwakeInterruptions() { ensureBubbleState() provider.addLegacySuppressor(alwaysSuppressesAwakeInterruptions) withLegacySuppressor(alwaysSuppressesAwakeInterruptions) { assertShouldNotBubble(buildBubbleEntry()) } } @Test fun testShouldBubble_legacySuppressAwakeHeadsUp() { ensureBubbleState() provider.addLegacySuppressor(alwaysSuppressesAwakeHeadsUp) withLegacySuppressor(alwaysSuppressesAwakeHeadsUp) { assertShouldBubble(buildBubbleEntry()) } } @Test fun testShouldNotAlert_hiddenOnKeyguard() { Loading Loading @@ -585,6 +591,15 @@ abstract class VisualInterruptionDecisionProviderTestBase : SysuiTestCase() { run(block) } protected fun withLegacySuppressor( suppressor: NotificationInterruptSuppressor, block: () -> Unit ) { provider.addLegacySuppressor(suppressor) block() provider.removeLegacySuppressor(suppressor) } protected fun assertShouldHeadsUp(entry: NotificationEntry) = provider.makeUnloggedHeadsUpDecision(entry).let { assertTrue("unexpected suppressed HUN: ${it.logReason}", it.shouldInterrupt) Loading