Merge "Adjust NetworkStatsServiceTest to mock out the JNI."
This commit is contained in:
@@ -198,6 +198,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
|||||||
@Mock
|
@Mock
|
||||||
private LocationPermissionChecker mLocationPermissionChecker;
|
private LocationPermissionChecker mLocationPermissionChecker;
|
||||||
private @Mock IBpfMap<U32, U8> mUidCounterSetMap;
|
private @Mock IBpfMap<U32, U8> mUidCounterSetMap;
|
||||||
|
private @Mock NetworkStatsService.TagStatsDeleter mTagStatsDeleter;
|
||||||
|
|
||||||
private NetworkStatsService mService;
|
private NetworkStatsService mService;
|
||||||
private INetworkStatsSession mSession;
|
private INetworkStatsSession mSession;
|
||||||
@@ -358,6 +359,11 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
|||||||
public IBpfMap<U32, U8> getUidCounterSetMap() {
|
public IBpfMap<U32, U8> getUidCounterSetMap() {
|
||||||
return mUidCounterSetMap;
|
return mUidCounterSetMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NetworkStatsService.TagStatsDeleter getTagStatsDeleter() {
|
||||||
|
return mTagStatsDeleter;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -696,8 +702,10 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
|||||||
final Intent intent = new Intent(ACTION_UID_REMOVED);
|
final Intent intent = new Intent(ACTION_UID_REMOVED);
|
||||||
intent.putExtra(EXTRA_UID, UID_BLUE);
|
intent.putExtra(EXTRA_UID, UID_BLUE);
|
||||||
mServiceContext.sendBroadcast(intent);
|
mServiceContext.sendBroadcast(intent);
|
||||||
|
verify(mTagStatsDeleter).deleteTagData(UID_BLUE);
|
||||||
intent.putExtra(EXTRA_UID, UID_RED);
|
intent.putExtra(EXTRA_UID, UID_RED);
|
||||||
mServiceContext.sendBroadcast(intent);
|
mServiceContext.sendBroadcast(intent);
|
||||||
|
verify(mTagStatsDeleter).deleteTagData(UID_RED);
|
||||||
|
|
||||||
// existing uid and total should remain unchanged; but removed UID
|
// existing uid and total should remain unchanged; but removed UID
|
||||||
// should be gone completely.
|
// should be gone completely.
|
||||||
|
|||||||
Reference in New Issue
Block a user