Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dc108b7e authored by Wes Okuhara's avatar Wes Okuhara
Browse files

Test screenshots from screen capture UI are detected

Screenshots sourced from the screen capture UI should not have the same
exemption from detection as those from overview.

Bug: 434009426
Test: atest ScreenshotDetectionControllerTest
Flag: TEST_ONLY
Change-Id: I156f6d8735e126f4740ba44042e19297fc57a2fb
parent c68f15b0
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import org.mockito.ArgumentMatcher
import org.mockito.Mock
import org.mockito.Mockito.mock
import org.mockito.Mockito.never
import org.mockito.Mockito.times
import org.mockito.Mockito.verify
import org.mockito.MockitoAnnotations

@@ -71,6 +72,19 @@ class ScreenshotDetectionControllerTest : SysuiTestCase() {
        verify(windowManager, never()).notifyScreenshotListeners(any())
    }

    @Test
    fun testMaybeNotifyOfScreenshot_evaluatesForScreenCaptureUISource() {
        val data =
            ScreenshotData.forTesting(
                source = WindowManager.ScreenshotSource.SCREENSHOT_SCREEN_CAPTURE_UI
            )

        val list = controller.maybeNotifyOfScreenshot(data)

        assertTrue(list.isEmpty())
        verify(windowManager, times(1)).notifyScreenshotListeners(any())
    }

    @Test
    fun testMaybeNotifyOfScreenshot_emptySet() {
        val data =