From 253206f4316d4fa0d4569eea00c5095d86c8f498 Mon Sep 17 00:00:00 2001 From: Motomu Utsumi Date: Mon, 13 Mar 2023 12:28:29 +0900 Subject: [PATCH] Split testFirewallBlocking to tests for each chain Bug: 271232428 Test: atest CtsNetTestCases Change-Id: Ib49a2fc566066ea2b33d52e1f0d6a0c0e02fbb00 --- .../net/cts/ConnectivityManagerTest.java | 47 ++++++++++++++++--- 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java b/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java index 0bb6000cc9..1bed83dd98 100644 --- a/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java +++ b/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java @@ -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); }