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

Commit 01662cde authored by David Saff's avatar David Saff
Browse files

Use factory for all cases to prevent test crash.

Bug: 406767164
Bug: 392677618
Test: https://android-build.corp.google.com/abtd/run/L58000030011895234/
Flag: TEST_ONLY
Change-Id: Ibc49917fb05e89714c37ea42109e5c5df52f9901
parent b6ac14b3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -547,7 +547,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI {
            return;
        }

        final SystemUIDialog d = new SystemUIDialog(mContext, R.style.Theme_SystemUI_Dialog_Alert);
        final SystemUIDialog d = mSystemUIDialogFactory.create();
        d.setCancelable(false);
        d.setIconAttribute(android.R.attr.alertDialogIcon);
        d.setTitle(R.string.high_temp_alarm_title);
+7 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.UserHandle;
import android.testing.TestableLooper;
import android.view.Window;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;
@@ -97,6 +98,10 @@ public class PowerNotificationWarningsTest extends SysuiTestCase {
    @Mock
    private SystemUIDialog mSystemUIDialog;

    @Mock
    private Window mDialogWindow;

    @Mock
    private BroadcastReceiver mReceiver;

    @Before
@@ -123,6 +128,7 @@ public class PowerNotificationWarningsTest extends SysuiTestCase {
        when(mUserTracker.getUserHandle()).thenReturn(
                UserHandle.of(ActivityManager.getCurrentUser()));
        when(mSystemUIDialogFactory.create()).thenReturn(mSystemUIDialog);
        when(mSystemUIDialog.getWindow()).thenReturn(mDialogWindow);
        mPowerNotificationWarnings = new PowerNotificationWarnings(
                wrapper,
                starter,
@@ -236,6 +242,7 @@ public class PowerNotificationWarningsTest extends SysuiTestCase {
        assertThat(mPowerNotificationWarnings.mUsbHighTempDialog).isNotNull();

        mPowerNotificationWarnings.mUsbHighTempDialog.dismiss();
        waitForIdleSync(mContext.getMainThreadHandler());
    }

    @Test