Test Data Stall with unknown detection type.
This CL adds a CTS test for Data Stall events to
ConnectivityDiagnostics. This makes sure that new DataStall detection
methods are passed to ConnectivityDiagnostics callbacks with the
appropriate detection method bit mask.
Bug: 156294356
Bug: 148032944
Test: atest ConnectivityDiagnosticsManagerTest
Change-Id: Id6f1bff59b08192f09ebcc4578a3c233fd1c2768
diff --git a/tests/cts/net/src/android/net/cts/ConnectivityDiagnosticsManagerTest.java b/tests/cts/net/src/android/net/cts/ConnectivityDiagnosticsManagerTest.java
index 8cacb43..0248f97 100644
--- a/tests/cts/net/src/android/net/cts/ConnectivityDiagnosticsManagerTest.java
+++ b/tests/cts/net/src/android/net/cts/ConnectivityDiagnosticsManagerTest.java
@@ -81,6 +81,8 @@
private static final int DNS_CONSECUTIVE_TIMEOUTS = 5;
private static final int COLLECTION_PERIOD_MILLIS = 5000;
private static final int FAIL_RATE_PERCENTAGE = 100;
+ private static final int UNKNOWN_DETECTION_METHOD = 4;
+ private static final int FILTERED_UNKNOWN_DETECTION_METHOD = 0;
private static final Executor INLINE_EXECUTOR = x -> x.run();
@@ -193,9 +195,28 @@
verifyOnDataStallSuspected(DETECTION_METHOD_TCP_METRICS, TIMESTAMP, extras);
}
+ @Test
+ public void testOnDataStallSuspected_UnknownDetectionMethod() throws Exception {
+ verifyOnDataStallSuspected(
+ UNKNOWN_DETECTION_METHOD,
+ FILTERED_UNKNOWN_DETECTION_METHOD,
+ TIMESTAMP,
+ PersistableBundle.EMPTY);
+ }
+
private void verifyOnDataStallSuspected(
int detectionMethod, long timestampMillis, @NonNull PersistableBundle extras)
throws Exception {
+ // Input detection method is expected to match received detection method
+ verifyOnDataStallSuspected(detectionMethod, detectionMethod, timestampMillis, extras);
+ }
+
+ private void verifyOnDataStallSuspected(
+ int inputDetectionMethod,
+ int expectedDetectionMethod,
+ long timestampMillis,
+ @NonNull PersistableBundle extras)
+ throws Exception {
mTestNetwork = setUpTestNetwork();
final TestConnectivityDiagnosticsCallback cb = new TestConnectivityDiagnosticsCallback();
@@ -208,11 +229,11 @@
runWithShellPermissionIdentity(
() -> mConnectivityManager.simulateDataStall(
- detectionMethod, timestampMillis, mTestNetwork, extras),
+ inputDetectionMethod, timestampMillis, mTestNetwork, extras),
android.Manifest.permission.MANAGE_TEST_NETWORKS);
cb.expectOnDataStallSuspected(
- mTestNetwork, interfaceName, detectionMethod, timestampMillis, extras);
+ mTestNetwork, interfaceName, expectedDetectionMethod, timestampMillis, extras);
cb.assertNoCallback();
}