Include NetworkCapabilities and LinkProperties in DataStallReport.
DataStallReport is updated to include the NetworkCapabilities and Link Properties for the Network being reported on. This provides a more complete picture of the Network conditions when the suspected data stall was detected. Bug: 148966398 Test: atest FrameworksNetTests Change-Id: I913cf18c348b9f688f9d2a3d25a71bc94eb8f000
This commit is contained in:
@@ -146,17 +146,14 @@ public class ConnectivityDiagnosticsManagerTest {
|
||||
|
||||
@Test
|
||||
public void testConnectivityReportEquals() {
|
||||
assertEquals(createSampleConnectivityReport(), createSampleConnectivityReport());
|
||||
assertEquals(createDefaultConnectivityReport(), createDefaultConnectivityReport());
|
||||
final ConnectivityReport defaultReport = createDefaultConnectivityReport();
|
||||
final ConnectivityReport sampleReport = createSampleConnectivityReport();
|
||||
assertEquals(sampleReport, createSampleConnectivityReport());
|
||||
assertEquals(defaultReport, createDefaultConnectivityReport());
|
||||
|
||||
final LinkProperties linkProperties = new LinkProperties();
|
||||
linkProperties.setInterfaceName(INTERFACE_NAME);
|
||||
|
||||
final NetworkCapabilities networkCapabilities = new NetworkCapabilities();
|
||||
networkCapabilities.addCapability(NetworkCapabilities.NET_CAPABILITY_IMS);
|
||||
|
||||
final PersistableBundle bundle = new PersistableBundle();
|
||||
bundle.putString(BUNDLE_KEY, BUNDLE_VALUE);
|
||||
final LinkProperties linkProperties = sampleReport.getLinkProperties();
|
||||
final NetworkCapabilities networkCapabilities = sampleReport.getNetworkCapabilities();
|
||||
final PersistableBundle bundle = sampleReport.getAdditionalInfo();
|
||||
|
||||
assertNotEquals(
|
||||
createDefaultConnectivityReport(),
|
||||
@@ -206,39 +203,104 @@ public class ConnectivityDiagnosticsManagerTest {
|
||||
}
|
||||
|
||||
private DataStallReport createSampleDataStallReport() {
|
||||
final LinkProperties linkProperties = new LinkProperties();
|
||||
linkProperties.setInterfaceName(INTERFACE_NAME);
|
||||
|
||||
final PersistableBundle bundle = new PersistableBundle();
|
||||
bundle.putString(BUNDLE_KEY, BUNDLE_VALUE);
|
||||
return new DataStallReport(new Network(NET_ID), TIMESTAMP, DETECTION_METHOD, bundle);
|
||||
|
||||
final NetworkCapabilities networkCapabilities = new NetworkCapabilities();
|
||||
networkCapabilities.addCapability(NetworkCapabilities.NET_CAPABILITY_IMS);
|
||||
|
||||
return new DataStallReport(
|
||||
new Network(NET_ID),
|
||||
TIMESTAMP,
|
||||
DETECTION_METHOD,
|
||||
linkProperties,
|
||||
networkCapabilities,
|
||||
bundle);
|
||||
}
|
||||
|
||||
private DataStallReport createDefaultDataStallReport() {
|
||||
return new DataStallReport(new Network(0), 0L, 0, PersistableBundle.EMPTY);
|
||||
return new DataStallReport(
|
||||
new Network(0),
|
||||
0L,
|
||||
0,
|
||||
new LinkProperties(),
|
||||
new NetworkCapabilities(),
|
||||
PersistableBundle.EMPTY);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDataStallReportEquals() {
|
||||
assertEquals(createSampleDataStallReport(), createSampleDataStallReport());
|
||||
assertEquals(createDefaultDataStallReport(), createDefaultDataStallReport());
|
||||
final DataStallReport defaultReport = createDefaultDataStallReport();
|
||||
final DataStallReport sampleReport = createSampleDataStallReport();
|
||||
assertEquals(sampleReport, createSampleDataStallReport());
|
||||
assertEquals(defaultReport, createDefaultDataStallReport());
|
||||
|
||||
final PersistableBundle bundle = new PersistableBundle();
|
||||
bundle.putString(BUNDLE_KEY, BUNDLE_VALUE);
|
||||
final LinkProperties linkProperties = sampleReport.getLinkProperties();
|
||||
final NetworkCapabilities networkCapabilities = sampleReport.getNetworkCapabilities();
|
||||
final PersistableBundle bundle = sampleReport.getStallDetails();
|
||||
|
||||
assertNotEquals(
|
||||
createDefaultDataStallReport(),
|
||||
new DataStallReport(new Network(NET_ID), 0L, 0, PersistableBundle.EMPTY));
|
||||
defaultReport,
|
||||
new DataStallReport(
|
||||
new Network(NET_ID),
|
||||
0L,
|
||||
0,
|
||||
new LinkProperties(),
|
||||
new NetworkCapabilities(),
|
||||
PersistableBundle.EMPTY));
|
||||
assertNotEquals(
|
||||
createDefaultDataStallReport(),
|
||||
new DataStallReport(new Network(0), TIMESTAMP, 0, PersistableBundle.EMPTY));
|
||||
defaultReport,
|
||||
new DataStallReport(
|
||||
new Network(0),
|
||||
TIMESTAMP,
|
||||
0,
|
||||
new LinkProperties(),
|
||||
new NetworkCapabilities(),
|
||||
PersistableBundle.EMPTY));
|
||||
assertNotEquals(
|
||||
createDefaultDataStallReport(),
|
||||
new DataStallReport(new Network(0), 0L, DETECTION_METHOD, PersistableBundle.EMPTY));
|
||||
defaultReport,
|
||||
new DataStallReport(
|
||||
new Network(0),
|
||||
0L,
|
||||
DETECTION_METHOD,
|
||||
new LinkProperties(),
|
||||
new NetworkCapabilities(),
|
||||
PersistableBundle.EMPTY));
|
||||
assertNotEquals(
|
||||
createDefaultDataStallReport(), new DataStallReport(new Network(0), 0L, 0, bundle));
|
||||
defaultReport,
|
||||
new DataStallReport(
|
||||
new Network(0),
|
||||
0L,
|
||||
0,
|
||||
linkProperties,
|
||||
new NetworkCapabilities(),
|
||||
PersistableBundle.EMPTY));
|
||||
assertNotEquals(
|
||||
defaultReport,
|
||||
new DataStallReport(
|
||||
new Network(0),
|
||||
0L,
|
||||
0,
|
||||
new LinkProperties(),
|
||||
networkCapabilities,
|
||||
PersistableBundle.EMPTY));
|
||||
assertNotEquals(
|
||||
defaultReport,
|
||||
new DataStallReport(
|
||||
new Network(0),
|
||||
0L,
|
||||
0,
|
||||
new LinkProperties(),
|
||||
new NetworkCapabilities(),
|
||||
bundle));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDataStallReportParcelUnparcel() {
|
||||
assertParcelSane(createSampleDataStallReport(), 4);
|
||||
assertParcelSane(createSampleDataStallReport(), 6);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user