[FUI05] Remove wimax data usage unit test
In follow-up patches, the network type will be derived from transport types, which officially doesn't support wimax. Thus, remove the test which rely on it first since it is not needed and will not be needed. Test: atest FrameworksNetTests Bug: 174123988 Change-Id: I713bc2ec39e3a4fa19ed13d2e9ff9ae35477d726
This commit is contained in:
@@ -21,7 +21,6 @@ import static android.content.Intent.EXTRA_UID;
|
|||||||
import static android.net.ConnectivityManager.TYPE_MOBILE;
|
import static android.net.ConnectivityManager.TYPE_MOBILE;
|
||||||
import static android.net.ConnectivityManager.TYPE_VPN;
|
import static android.net.ConnectivityManager.TYPE_VPN;
|
||||||
import static android.net.ConnectivityManager.TYPE_WIFI;
|
import static android.net.ConnectivityManager.TYPE_WIFI;
|
||||||
import static android.net.ConnectivityManager.TYPE_WIMAX;
|
|
||||||
import static android.net.NetworkStats.DEFAULT_NETWORK_ALL;
|
import static android.net.NetworkStats.DEFAULT_NETWORK_ALL;
|
||||||
import static android.net.NetworkStats.DEFAULT_NETWORK_NO;
|
import static android.net.NetworkStats.DEFAULT_NETWORK_NO;
|
||||||
import static android.net.NetworkStats.DEFAULT_NETWORK_YES;
|
import static android.net.NetworkStats.DEFAULT_NETWORK_YES;
|
||||||
@@ -566,61 +565,6 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testUid3gWimaxCombinedByTemplate() throws Exception {
|
|
||||||
// pretend that network comes online
|
|
||||||
expectDefaultSettings();
|
|
||||||
NetworkState[] states = new NetworkState[] {buildMobile3gState(IMSI_1)};
|
|
||||||
expectNetworkStatsSummary(buildEmptyStats());
|
|
||||||
expectNetworkStatsUidDetail(buildEmptyStats());
|
|
||||||
|
|
||||||
mService.forceUpdateIfaces(NETWORKS_MOBILE, states, getActiveIface(states), new VpnInfo[0]);
|
|
||||||
|
|
||||||
// create some traffic
|
|
||||||
incrementCurrentTime(HOUR_IN_MILLIS);
|
|
||||||
expectDefaultSettings();
|
|
||||||
expectNetworkStatsSummary(buildEmptyStats());
|
|
||||||
expectNetworkStatsUidDetail(new NetworkStats(getElapsedRealtime(), 1)
|
|
||||||
.insertEntry(TEST_IFACE, UID_RED, SET_DEFAULT, TAG_NONE, 1024L, 8L, 1024L, 8L, 0L)
|
|
||||||
.insertEntry(TEST_IFACE, UID_RED, SET_DEFAULT, 0xF00D, 512L, 4L, 512L, 4L, 0L));
|
|
||||||
mService.incrementOperationCount(UID_RED, 0xF00D, 5);
|
|
||||||
|
|
||||||
forcePollAndWaitForIdle();
|
|
||||||
|
|
||||||
// verify service recorded history
|
|
||||||
assertUidTotal(sTemplateImsi1, UID_RED, 1024L, 8L, 1024L, 8L, 5);
|
|
||||||
|
|
||||||
|
|
||||||
// now switch over to wimax network
|
|
||||||
incrementCurrentTime(HOUR_IN_MILLIS);
|
|
||||||
expectDefaultSettings();
|
|
||||||
states = new NetworkState[] {buildWimaxState(TEST_IFACE2)};
|
|
||||||
expectNetworkStatsSummary(buildEmptyStats());
|
|
||||||
expectNetworkStatsUidDetail(new NetworkStats(getElapsedRealtime(), 1)
|
|
||||||
.insertEntry(TEST_IFACE, UID_RED, SET_DEFAULT, TAG_NONE, 1024L, 8L, 1024L, 8L, 0L)
|
|
||||||
.insertEntry(TEST_IFACE, UID_RED, SET_DEFAULT, 0xF00D, 512L, 4L, 512L, 4L, 0L));
|
|
||||||
|
|
||||||
mService.forceUpdateIfaces(NETWORKS_MOBILE, states, getActiveIface(states), new VpnInfo[0]);
|
|
||||||
forcePollAndWaitForIdle();
|
|
||||||
|
|
||||||
|
|
||||||
// create traffic on second network
|
|
||||||
incrementCurrentTime(HOUR_IN_MILLIS);
|
|
||||||
expectDefaultSettings();
|
|
||||||
expectNetworkStatsSummary(buildEmptyStats());
|
|
||||||
expectNetworkStatsUidDetail(new NetworkStats(getElapsedRealtime(), 1)
|
|
||||||
.insertEntry(TEST_IFACE, UID_RED, SET_DEFAULT, TAG_NONE, 1024L, 8L, 1024L, 8L, 0L)
|
|
||||||
.insertEntry(TEST_IFACE, UID_RED, SET_DEFAULT, 0xF00D, 512L, 4L, 512L, 4L, 0L)
|
|
||||||
.insertEntry(TEST_IFACE2, UID_RED, SET_DEFAULT, TAG_NONE, 512L, 4L, 256L, 2L, 0L)
|
|
||||||
.insertEntry(TEST_IFACE2, UID_RED, SET_DEFAULT, 0xFAAD, 512L, 4L, 256L, 2L, 0L));
|
|
||||||
mService.incrementOperationCount(UID_RED, 0xFAAD, 5);
|
|
||||||
|
|
||||||
forcePollAndWaitForIdle();
|
|
||||||
|
|
||||||
// verify that ALL_MOBILE template combines both
|
|
||||||
assertUidTotal(sTemplateImsi1, UID_RED, 1536L, 12L, 1280L, 10L, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMobileStatsByRatType() throws Exception {
|
public void testMobileStatsByRatType() throws Exception {
|
||||||
final NetworkTemplate template3g =
|
final NetworkTemplate template3g =
|
||||||
@@ -1525,17 +1469,6 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
|||||||
return new NetworkState(info, prop, capabilities, MOBILE_NETWORK, subscriberId, null);
|
return new NetworkState(info, prop, capabilities, MOBILE_NETWORK, subscriberId, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static NetworkState buildWimaxState(@NonNull String iface) {
|
|
||||||
final NetworkInfo info = new NetworkInfo(TYPE_WIMAX, 0, null, null);
|
|
||||||
info.setDetailedState(DetailedState.CONNECTED, null, null);
|
|
||||||
final LinkProperties prop = new LinkProperties();
|
|
||||||
prop.setInterfaceName(iface);
|
|
||||||
final NetworkCapabilities capabilities = new NetworkCapabilities();
|
|
||||||
capabilities.setCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED, false);
|
|
||||||
capabilities.setCapability(NetworkCapabilities.NET_CAPABILITY_NOT_ROAMING, true);
|
|
||||||
return new NetworkState(info, prop, capabilities, MOBILE_NETWORK, null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private NetworkStats buildEmptyStats() {
|
private NetworkStats buildEmptyStats() {
|
||||||
return new NetworkStats(getElapsedRealtime(), 0);
|
return new NetworkStats(getElapsedRealtime(), 0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user