Fix a WTF in IpServerTest. am: ae27ecf5ad

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1557107

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3da0e7ad36002361287e63a8724e25dcd940bd0c
This commit is contained in:
Lorenzo Colitti
2021-01-26 11:20:10 +00:00
committed by Automerger Merge Worker

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