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

Commit 121f5105 authored by Behnam Heydarshahi's avatar Behnam Heydarshahi
Browse files

Fix volume CSD tests not cleanring up

Clear the handler internal to VolumeDialogImpl on test teardown.

Bug: b/278069856
Test: atest VolumeDialogImplTest
Change-Id: I69440ab86b98a2ce95b38f6b6e9cca9b24d11fa1
parent 511e50ac
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -2343,6 +2343,13 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
        }
    }

    @VisibleForTesting
    void clearInternalHandleAfterTest() {
        if (mHandler != null) {
            mHandler.removeCallbacksAndMessages(null);
        }
    }

    private final class CustomDialog extends Dialog implements DialogInterface {
        public CustomDialog(Context context) {
            super(context, R.style.volume_dialog_theme);
+8 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ import com.android.systemui.util.DeviceConfigProxyFake;
import com.android.systemui.util.concurrency.FakeExecutor;
import com.android.systemui.util.time.FakeSystemClock;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -370,6 +371,13 @@ public class VolumeDialogImplTest extends SysuiTestCase {
        verify(mCsdWarningDialog).show();
    }

    @After
    public void teardown() {
        if (mDialog != null) {
            mDialog.clearInternalHandleAfterTest();
        }
    }

/*
    @Test
    public void testContentDescriptions() {