Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2072ba09 authored by Chiachang Wang's avatar Chiachang Wang Committed by Automerger Merge Worker
Browse files

Merge "Remove unnecessary transport parameter" am: 86b8d5b5 am: 9e2fdec9

Change-Id: I15589d68527f1b210f5258e97dc899834ac852bf
parents 31a7e184 9e2fdec9
Loading
Loading
Loading
Loading
+17 −21
Original line number Diff line number Diff line
@@ -1823,18 +1823,16 @@ public class NetworkMonitorTest {

    @Test
    public void testDataStall_StallTcpSuspectedAndSendMetricsOnCell() throws Exception {
        testDataStall_StallTcpSuspectedAndSendMetrics(NetworkCapabilities.TRANSPORT_CELLULAR,
                CELL_METERED_CAPABILITIES);
        testDataStall_StallTcpSuspectedAndSendMetrics(CELL_METERED_CAPABILITIES);
    }

    @Test
    public void testDataStall_StallTcpSuspectedAndSendMetricsOnWifi() throws Exception {
        testDataStall_StallTcpSuspectedAndSendMetrics(NetworkCapabilities.TRANSPORT_WIFI,
                WIFI_NOT_METERED_CAPABILITIES);
        testDataStall_StallTcpSuspectedAndSendMetrics(WIFI_NOT_METERED_CAPABILITIES);
    }

    private void testDataStall_StallTcpSuspectedAndSendMetrics(int transport,
            NetworkCapabilities nc) throws Exception {
    private void testDataStall_StallTcpSuspectedAndSendMetrics(NetworkCapabilities nc)
            throws Exception {
        assumeTrue(ShimUtils.isReleaseOrDevelopmentApiAbove(Build.VERSION_CODES.Q));
        // NM suspects data stall from TCP signal and sends data stall metrics.
        setDataStallEvaluationType(DATA_STALL_EVALUATION_TYPE_TCP);
@@ -1843,7 +1841,10 @@ public class NetworkMonitorTest {
        // Trigger a tcp event immediately.
        setTcpPollingInterval(0);
        nm.sendTcpPollingEvent();
        verifySendDataStallDetectionStats(nm, DATA_STALL_EVALUATION_TYPE_TCP, transport);
        // Allow only one transport type in the context of this test for simplification.
        final int[] transports = nc.getTransportTypes();
        assertEquals(1, transports.length);
        verifySendDataStallDetectionStats(nm, DATA_STALL_EVALUATION_TYPE_TCP, transports[0]);
    }

    private WrappedNetworkMonitor prepareNetworkMonitorForVerifyDataStall(NetworkCapabilities nc)
@@ -1852,18 +1853,13 @@ public class NetworkMonitorTest {
        // evaluation will only start from validated state.
        setStatus(mHttpsConnection, 204);
        final WrappedNetworkMonitor nm;
        final int[] transports = nc.getTransportTypes();
        // Though multiple transport types are allowed, use the first transport type for
        // simplification.
        switch (transports[0]) {
            case NetworkCapabilities.TRANSPORT_CELLULAR:
        // Allow only one transport type in the context of this test for simplification.
        if (nc.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR)) {
            nm = makeCellMeteredNetworkMonitor();
                break;
            case NetworkCapabilities.TRANSPORT_WIFI:
        } else if (nc.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)) {
            nm = makeWifiNotMeteredNetworkMonitor();
            setupTestWifiInfo();
                break;
            default:
        } else {
            nm = null;
            fail("Undefined transport type");
        }