Merge "Split testFirewallBlocking to tests for each chain"

This commit is contained in:
Treehugger Robot
2023-03-13 06:50:20 +00:00
committed by Gerrit Code Review

View File

@@ -3406,6 +3406,9 @@ public class ConnectivityManagerTest {
private static final boolean EXPECT_PASS = false;
private static final boolean EXPECT_BLOCK = true;
// ALLOWLIST means the firewall denies all by default, uids must be explicitly allowed
// DENYLIST means the firewall allows all by default, uids must be explicitly denyed
private static final boolean ALLOWLIST = true;
private static final boolean DENYLIST = false;
@@ -3471,17 +3474,49 @@ public class ConnectivityManagerTest {
@Test @IgnoreUpTo(SC_V2) @ConnectivityModuleTest
@AppModeFull(reason = "Socket cannot bind in instant app mode")
public void testFirewallBlocking() {
// ALLOWLIST means the firewall denies all by default, uids must be explicitly allowed
public void testFirewallBlockingDozable() {
doTestFirewallBlocking(FIREWALL_CHAIN_DOZABLE, ALLOWLIST);
doTestFirewallBlocking(FIREWALL_CHAIN_POWERSAVE, ALLOWLIST);
doTestFirewallBlocking(FIREWALL_CHAIN_RESTRICTED, ALLOWLIST);
doTestFirewallBlocking(FIREWALL_CHAIN_LOW_POWER_STANDBY, ALLOWLIST);
}
// DENYLIST means the firewall allows all by default, uids must be explicitly denyed
@Test @IgnoreUpTo(SC_V2) @ConnectivityModuleTest
@AppModeFull(reason = "Socket cannot bind in instant app mode")
public void testFirewallBlockingPowersave() {
doTestFirewallBlocking(FIREWALL_CHAIN_POWERSAVE, ALLOWLIST);
}
@Test @IgnoreUpTo(SC_V2) @ConnectivityModuleTest
@AppModeFull(reason = "Socket cannot bind in instant app mode")
public void testFirewallBlockingRestricted() {
doTestFirewallBlocking(FIREWALL_CHAIN_RESTRICTED, ALLOWLIST);
}
@Test @IgnoreUpTo(SC_V2) @ConnectivityModuleTest
@AppModeFull(reason = "Socket cannot bind in instant app mode")
public void testFirewallBlockingLowPowerStandby() {
doTestFirewallBlocking(FIREWALL_CHAIN_LOW_POWER_STANDBY, ALLOWLIST);
}
@Test @IgnoreUpTo(SC_V2) @ConnectivityModuleTest
@AppModeFull(reason = "Socket cannot bind in instant app mode")
public void testFirewallBlockingStandby() {
doTestFirewallBlocking(FIREWALL_CHAIN_STANDBY, DENYLIST);
}
@Test @IgnoreUpTo(SC_V2) @ConnectivityModuleTest
@AppModeFull(reason = "Socket cannot bind in instant app mode")
public void testFirewallBlockingOemDeny1() {
doTestFirewallBlocking(FIREWALL_CHAIN_OEM_DENY_1, DENYLIST);
}
@Test @IgnoreUpTo(SC_V2) @ConnectivityModuleTest
@AppModeFull(reason = "Socket cannot bind in instant app mode")
public void testFirewallBlockingOemDeny2() {
doTestFirewallBlocking(FIREWALL_CHAIN_OEM_DENY_2, DENYLIST);
}
@Test @IgnoreUpTo(SC_V2) @ConnectivityModuleTest
@AppModeFull(reason = "Socket cannot bind in instant app mode")
public void testFirewallBlockingOemDeny3() {
doTestFirewallBlocking(FIREWALL_CHAIN_OEM_DENY_3, DENYLIST);
}