Fix a WTF in IpServerTest. am: ae27ecf5ad am: 595a330cc6
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1557107 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: Ie29e806685ee0930ec00ad85f8f9c15ace3e6cf6
This commit is contained in:
@@ -881,6 +881,11 @@ public class IpServerTest {
|
|||||||
.thenReturn(buildEmptyTetherStatsParcel(UPSTREAM_IFINDEX));
|
.thenReturn(buildEmptyTetherStatsParcel(UPSTREAM_IFINDEX));
|
||||||
when(mNetd.tetherOffloadGetAndClearStats(UPSTREAM_IFINDEX2))
|
when(mNetd.tetherOffloadGetAndClearStats(UPSTREAM_IFINDEX2))
|
||||||
.thenReturn(buildEmptyTetherStatsParcel(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
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user