Disable APP_ARCHIVING flag for specific test
APP_ARCHIVING flag was introduced to control archiving feature in Settings separately from OS. The broken test was expecting archiving feature flag be disabled but it didn't take into account a newly introduced flag which was automatically rolled out in ag/26270549 Test: InstalledAppCounterTest Bug: n/a Change-Id: I253cf7e6b28c9f1508c3f9fd1104fdb06b8706c2
This commit is contained in:
@@ -41,9 +41,11 @@ import android.content.pm.ResolveInfo;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.platform.test.flag.junit.SetFlagsRule;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentMatcher;
|
||||
@@ -85,6 +87,9 @@ public final class InstalledAppCounterTest {
|
||||
@Mock
|
||||
private PackageManager mPackageManager;
|
||||
|
||||
@Rule
|
||||
public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
|
||||
|
||||
private int mInstalledAppCount = -1;
|
||||
private ApplicationInfo mApp1;
|
||||
private ApplicationInfo mApp2;
|
||||
@@ -218,6 +223,7 @@ public final class InstalledAppCounterTest {
|
||||
eq(MAIN_USER_ID))).thenReturn(Arrays.asList(mApp2));
|
||||
|
||||
mFakeFeatureFlags.setFlag(Flags.FLAG_ARCHIVING, false);
|
||||
mSetFlagsRule.disableFlags(com.android.settings.flags.Flags.FLAG_APP_ARCHIVING);
|
||||
// Count the number of all apps installed, irrespective of install reason.
|
||||
count(InstalledAppCounter.IGNORE_INSTALL_REASON, mFakeFeatureFlags);
|
||||
assertThat(mInstalledAppCount).isEqualTo(1);
|
||||
|
Reference in New Issue
Block a user