diff --git a/service/native/TrafficControllerTest.cpp b/service/native/TrafficControllerTest.cpp index edefbb43c6..4f33c1603a 100644 --- a/service/native/TrafficControllerTest.cpp +++ b/service/native/TrafficControllerTest.cpp @@ -718,6 +718,31 @@ TEST_F(TrafficControllerTest, TestDumpsys) { EXPECT_TRUE(expectDumpsysContains(expectedLines)); } +TEST_F(TrafficControllerTest, getFirewallType) { + static const struct TestConfig { + ChildChain childChain; + FirewallType firewallType; + } testConfigs[] = { + // clang-format off + {NONE, DENYLIST}, + {DOZABLE, ALLOWLIST}, + {STANDBY, DENYLIST}, + {POWERSAVE, ALLOWLIST}, + {RESTRICTED, ALLOWLIST}, + {LOW_POWER_STANDBY, ALLOWLIST}, + {LOCKDOWN, DENYLIST}, + {OEM_DENY_1, DENYLIST}, + {OEM_DENY_2, DENYLIST}, + {INVALID_CHAIN, DENYLIST}, + // clang-format on + }; + + for (const auto& config : testConfigs) { + SCOPED_TRACE(fmt::format("testConfig: [{}, {}]", config.childChain, config.firewallType)); + EXPECT_EQ(config.firewallType, mTc.getFirewallType(config.childChain)); + } +} + constexpr uint32_t SOCK_CLOSE_WAIT_US = 30 * 1000; constexpr uint32_t ENOBUFS_POLL_WAIT_US = 10 * 1000;