Fix a WTF in IpServerTest.

Bug: 178324405
Test: atest TetheringTests
Change-Id: I2069ea79f982e6bb197388edd7820a05d1e651f1
This commit is contained in:
Lorenzo Colitti
2021-01-26 15:12:25 +09:00
parent dc4189f0e4
commit ae27ecf5ad

View File

@@ -881,6 +881,11 @@ public class IpServerTest {
.thenReturn(buildEmptyTetherStatsParcel(UPSTREAM_IFINDEX));
when(mNetd.tetherOffloadGetAndClearStats(UPSTREAM_IFINDEX2))
.thenReturn(buildEmptyTetherStatsParcel(UPSTREAM_IFINDEX2));
// When the last rule is removed, tetherOffloadGetAndClearStats will log a WTF (and
// potentially crash the test) if the stats map is empty.
final TetherStatsValue allZeros = new TetherStatsValue(0, 0, 0, 0, 0, 0);
when(mBpfStatsMap.getValue(new TetherStatsKey(UPSTREAM_IFINDEX))).thenReturn(allZeros);
when(mBpfStatsMap.getValue(new TetherStatsKey(UPSTREAM_IFINDEX2))).thenReturn(allZeros);
}
@Test