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

Commit 2586013b authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Prevent any unexpected Log.wtf calls" into main

parents fd3b8469 cfd624a1
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ import org.mockito.kotlin.verify

@SmallTest
@RunWith(AndroidJUnit4::class)
@EnableFlags(Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR)
class KeyguardStateCallbackInteractorTest : SysuiTestCase() {

    private val kosmos = testKosmos()
@@ -81,7 +82,6 @@ class KeyguardStateCallbackInteractorTest : SysuiTestCase() {
        }

    @Test
    @EnableFlags(Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR)
    fun test_lockscreenVisibility_notifyDismissSucceeded_ifNotVisible() =
        testScope.runTest {
            underTest.addCallback(callback)
@@ -109,7 +109,6 @@ class KeyguardStateCallbackInteractorTest : SysuiTestCase() {
        }

    @Test
    @EnableFlags(Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR)
    fun test_lockscreenVisibility_reportsKeyguardShowingChanged() =
        testScope.runTest {
            underTest.addCallback(callback)
+3 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.shade.display

import android.platform.test.annotations.EnableFlags
import android.view.Display
import android.view.Display.TYPE_EXTERNAL
import android.view.MotionEvent
@@ -31,6 +32,7 @@ import com.android.systemui.kosmos.useUnconfinedTestDispatcher
import com.android.systemui.shade.data.repository.statusBarTouchShadeDisplayPolicy
import com.android.systemui.shade.domain.interactor.notificationElement
import com.android.systemui.shade.domain.interactor.qsElement
import com.android.systemui.shade.shared.flag.ShadeWindowGoesAround
import com.android.systemui.testKosmos
import com.google.common.truth.Truth.assertThat
import kotlin.test.Test
@@ -41,6 +43,7 @@ import org.mockito.kotlin.mock

@SmallTest
@RunWith(AndroidJUnit4::class)
@EnableFlags(ShadeWindowGoesAround.FLAG_NAME)
class StatusBarTouchShadeDisplayPolicyTest : SysuiTestCase() {
    private val kosmos = testKosmos().useUnconfinedTestDispatcher()
    private val testScope = kosmos.testScope
+3 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui.shade.domain.interactor

import android.content.res.Configuration
import android.content.res.mockResources
import android.platform.test.annotations.EnableFlags
import android.view.Display
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
@@ -27,6 +28,7 @@ import com.android.systemui.kosmos.testScope
import com.android.systemui.kosmos.useUnconfinedTestDispatcher
import com.android.systemui.scene.ui.view.mockShadeRootView
import com.android.systemui.shade.data.repository.fakeShadeDisplaysRepository
import com.android.systemui.shade.shared.flag.ShadeWindowGoesAround
import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository
import com.android.systemui.statusbar.notification.data.repository.setActiveNotifs
import com.android.systemui.statusbar.notification.row.notificationRebindingTracker
@@ -47,6 +49,7 @@ import org.mockito.kotlin.whenever

@RunWith(AndroidJUnit4::class)
@SmallTest
@EnableFlags(ShadeWindowGoesAround.FLAG_NAME)
class ShadeDisplaysInteractorTest : SysuiTestCase() {
    private val kosmos = testKosmos().useUnconfinedTestDispatcher()

+8 −4
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;

import com.android.systemui.SysuiTestCase;
import com.android.systemui.log.LogAssertKt;
import com.android.systemui.plugins.Plugin;
import com.android.systemui.plugins.PluginLifecycleManager;
import com.android.systemui.plugins.PluginListener;
@@ -138,11 +139,12 @@ public class PluginInstanceTest extends SysuiTestCase {

        mVersionCheckResult = false;
        assertFalse(mPluginInstance.hasError());

        mPluginInstanceFactory.create(
                mContext, mAppInfo, wrongVersionTestPluginComponentName,
                TestPlugin.class, mPluginListener);
        LogAssertKt.assertLogsWtf(()-> {
            mPluginInstance.onCreate();
        });
        assertTrue(mPluginInstance.hasError());
        assertNull(mPluginInstance.getPlugin());
    }
@@ -193,8 +195,10 @@ public class PluginInstanceTest extends SysuiTestCase {
        mPluginInstance.onCreate();
        assertFalse(mPluginInstance.hasError());

        LogAssertKt.assertLogsWtf(()-> {
            Object result = mPluginInstance.getPlugin().methodThrowsError();
            assertNotNull(result);  // Wrapper function should return non-null;
        });
        assertTrue(mPluginInstance.hasError());
        assertNull(mPluginInstance.getPlugin());
    }
+2 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import com.android.systemui.kosmos.collectLastValue
import com.android.systemui.kosmos.runTest
import com.android.systemui.kosmos.useUnconfinedTestDispatcher
import com.android.systemui.statusbar.StatusBarIconView
import com.android.systemui.statusbar.chips.notification.shared.StatusBarNotifChips
import com.android.systemui.statusbar.core.StatusBarConnectedDisplays
import com.android.systemui.statusbar.notification.data.model.activeNotificationModel
import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel
@@ -39,6 +40,7 @@ import org.mockito.kotlin.mock

@SmallTest
@RunWith(AndroidJUnit4::class)
@EnableFlags(StatusBarNotifChips.FLAG_NAME)
class SingleNotificationChipInteractorTest : SysuiTestCase() {
    private val kosmos = testKosmos().useUnconfinedTestDispatcher()
    val factory = kosmos.singleNotificationChipInteractorFactory
Loading