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

Commit 86814543 authored by Ibrahim Yilmaz's avatar Ibrahim Yilmaz
Browse files

[PreferencesHelperTest] Ensure promoted value NOT depend on default value

CAN_HAVE_PROMOTED_NOTIFS is true by default. So, setCanBePromoted with promoted:true doesn't trigger the code pointer we want to test and make our test default value dependent.
This CL sets it false initially to make the test not dependent on default value.
Bug: 367705002
Flag: android.app.ui_rich_ongoing
Test: Presubmit

Change-Id: I4065de81997766d51ccae088d089955e53525ed0
parent ab4eafb6
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -259,6 +259,7 @@ public class PreferencesHelperTest extends UiServiceTestCase {
    public static List<FlagsParameterization> getParams() {
        return FlagsParameterization.allCombinationsOf(
                android.app.Flags.FLAG_API_RICH_ONGOING,
                android.app.Flags.FLAG_UI_RICH_ONGOING,
                FLAG_NOTIFICATION_CLASSIFICATION, FLAG_NOTIFICATION_CLASSIFICATION_UI,
                FLAG_MODES_UI);
    }
@@ -661,6 +662,7 @@ public class PreferencesHelperTest extends UiServiceTestCase {

        mHelper.setShowBadge(PKG_N_MR1, UID_N_MR1, true);
        if (android.app.Flags.uiRichOngoing()) {
            mHelper.setCanBePromoted(PKG_N_MR1, UID_N_MR1, false, true);
            mHelper.setCanBePromoted(PKG_N_MR1, UID_N_MR1, true, true);
        }

@@ -6640,6 +6642,8 @@ public class PreferencesHelperTest extends UiServiceTestCase {
    @Test
    @EnableFlags(android.app.Flags.FLAG_API_RICH_ONGOING)
    public void testSetCanBePromoted_allowlistNotOverrideUser() {
        // default value is true. So we need to set it false to trigger the change.
        mHelper.setCanBePromoted(PKG_P, UID_P, false, true);
        mHelper.setCanBePromoted(PKG_P, UID_P, true, true);
        assertThat(mHelper.canBePromoted(PKG_P, UID_P)).isTrue();