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

Commit e85b1b08 authored by Bryce Lee's avatar Bryce Lee
Browse files

Fix DreamOverlayServiceTest.

This changelist addresses issues with testCallbacksRunOnExecutor.

Test: atest DreamOverlayServiceTest#testCallbacksRunOnExecutor
Flag: EXEMPT bugfix
Fixes: 293108088
Change-Id: I6a885ab70a4d19cf9371a9b09e839345c4782860
parent fddf3266
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ import android.service.dreams.IDreamOverlayClientCallback;
import android.view.WindowManager;

import androidx.annotation.NonNull;
import androidx.test.filters.FlakyTest;
import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;

@@ -106,6 +105,12 @@ public class DreamOverlayServiceTest {
            mMonitor.onEndDream();
            super.onEndDream();
        }

        @Override
        public void onWakeUp() {
            mMonitor.onWakeUp();
            super.onWakeUp();
        }
    }

    /**
@@ -128,7 +133,6 @@ public class DreamOverlayServiceTest {
     * Verifies that callbacks for subclasses are run on the provided executor.
     */
    @Test
    @FlakyTest(bugId = 293108088)
    public void testCallbacksRunOnExecutor() throws RemoteException {
        final TestDreamOverlayService.Monitor monitor = Mockito.mock(
                TestDreamOverlayService.Monitor.class);
@@ -153,6 +157,8 @@ public class DreamOverlayServiceTest {
        // Callback is run.
        verify(monitor).onStartDream();

        clearInvocations(mExecutor);

        // Verify onWakeUp is run on the executor.
        client.wakeUp();
        verify(monitor, never()).onWakeUp();
@@ -161,6 +167,8 @@ public class DreamOverlayServiceTest {
        mRunnableCaptor.getValue().run();
        verify(monitor).onWakeUp();

        clearInvocations(mExecutor);

        // Verify onEndDream is run on the executor.
        client.endDream();
        verify(monitor, never()).onEndDream();