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

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

Merge "Include notification-related tests in FrameworksCoreTests in presubmit" into main

parents 9a777c84 bb01c32b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.content.ComponentName;
import android.net.Uri;
import android.os.Parcel;
import android.platform.test.annotations.EnableFlags;
import android.platform.test.annotations.Presubmit;
import android.platform.test.flag.junit.SetFlagsRule;

import androidx.test.ext.junit.runners.AndroidJUnit4;
@@ -39,6 +40,7 @@ import org.junit.runner.RunWith;
import java.lang.reflect.Field;

@RunWith(AndroidJUnit4.class)
@Presubmit
@SmallTest
public class AutomaticZenRuleTest {
    private static final String CLASS = "android.app.AutomaticZenRule";
+2 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertTrue;

import android.os.Parcel;
import android.test.AndroidTestCase;
import android.platform.test.annotations.Presubmit;
import android.text.TextUtils;

import androidx.test.filters.SmallTest;
@@ -35,6 +35,7 @@ import java.lang.reflect.Field;

@RunWith(AndroidJUnit4.class)
@SmallTest
@Presubmit
public class NotificationChannelGroupTest {
    private final String CLASS = "android.app.NotificationChannelGroup";

+2 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import android.os.Parcel;
import android.os.RemoteCallback;
import android.os.RemoteException;
import android.os.VibrationEffect;
import android.platform.test.annotations.Presubmit;
import android.platform.test.flag.junit.SetFlagsRule;
import android.provider.MediaStore.Audio.AudioColumns;
import android.test.mock.MockContentResolver;
@@ -74,6 +75,7 @@ import java.util.function.Consumer;

@RunWith(AndroidJUnit4.class)
@SmallTest
@Presubmit
public class NotificationChannelTest {
    @Rule
    public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
+12 −4
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static com.google.common.truth.Truth.assertThat;
import android.app.NotificationHistory.HistoricalNotification;
import android.graphics.drawable.Icon;
import android.os.Parcel;
import android.platform.test.annotations.Presubmit;

import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
@@ -35,13 +36,19 @@ import java.util.List;
import java.util.Set;

@RunWith(AndroidJUnit4.class)
@Presubmit
public class NotificationHistoryTest {

    private HistoricalNotification getHistoricalNotification(int index) {
    private static HistoricalNotification getHistoricalNotification(int index) {
        return getHistoricalNotification("package" + index, index);
    }

    private HistoricalNotification getHistoricalNotification(String packageName, int index) {
    private static HistoricalNotification getHistoricalNotification(String packageName, int index) {
        return getHistoricalNotification(packageName, index, /* includeIcon= */ true);
    }

    private static HistoricalNotification getHistoricalNotification(String packageName, int index,
            boolean includeIcon) {
        String expectedChannelName = "channelName" + index;
        String expectedChannelId = "channelId" + index;
        int expectedUid = 1123456 + index;
@@ -65,7 +72,7 @@ public class NotificationHistoryTest {
                .setPostedTimeMs(expectedPostTime)
                .setTitle(expectedTitle)
                .setText(expectedText)
                .setIcon(expectedIcon)
                .setIcon(includeIcon ? expectedIcon : null)
                .setConversationId(conversationId)
                .build();
    }
@@ -376,7 +383,8 @@ public class NotificationHistoryTest {

        List<HistoricalNotification> expectedEntries = new ArrayList<>();
        for (int i = 10; i >= 1; i--) {
            HistoricalNotification n = getHistoricalNotification(i);
            HistoricalNotification n = getHistoricalNotification("packageName" + i,
                    i, /* includeIcon= */ false);
            expectedEntries.add(n);
            history.addNotificationToWrite(n);
        }
+7 −0
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemProperties;
import android.platform.test.annotations.Presubmit;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
@@ -107,6 +108,7 @@ import junit.framework.Assert;
import libcore.junit.util.compat.CoreCompatChangeRule;

import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestRule;
@@ -117,6 +119,7 @@ import java.util.function.Consumer;

@RunWith(AndroidJUnit4.class)
@SmallTest
@Presubmit
public class NotificationTest {

    private Context mContext;
@@ -768,6 +771,7 @@ public class NotificationTest {
    }

    @Test
    @Ignore // TODO: b/329389261 - Restore or delete
    public void testColors_ensureColors_dayMode_producesValidPalette() {
        Notification.Colors c = new Notification.Colors();
        boolean colorized = false;
@@ -796,6 +800,7 @@ public class NotificationTest {
    }

    @Test
    @Ignore // TODO: b/329389261 - Restore or delete
    public void testColors_ensureColors_colorized_producesValidPalette_red() {
        validateColorizedPaletteForColor(Color.RED);
    }
@@ -1244,6 +1249,7 @@ public class NotificationTest {
    }

    @Test
    @Ignore // TODO: b/329402256 - Restore or delete
    public void testBigPictureStyle_setExtras_pictureIconNull_pictureIconKeyNull() {
        Notification.BigPictureStyle bpStyle = new Notification.BigPictureStyle();
        bpStyle.bigPicture((Bitmap) null);
@@ -1257,6 +1263,7 @@ public class NotificationTest {
    }

    @Test
    @Ignore // TODO: b/329402256 - Restore or delete
    public void testBigPictureStyle_setExtras_pictureIconNull_pictureKeyNull() {
        Notification.BigPictureStyle bpStyle = new Notification.BigPictureStyle();
        bpStyle.bigPicture((Bitmap) null);