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

Commit b1296e90 authored by Lorenzo Colitti's avatar Lorenzo Colitti Committed by Automerger Merge Worker
Browse files

Merge "Make MockVpn more realistic and easier to use." am: e191d8d9

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1501814

Change-Id: I6584e231913841dc218573dc586429cd720621a3
parents f58d0c7d e191d8d9
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -200,7 +200,8 @@ class ConnectivityServiceIntegrationTest {
        nsInstrumentation.addHttpResponse(HttpResponse(httpProbeUrl, responseCode = 204))
        nsInstrumentation.addHttpResponse(HttpResponse(httpProbeUrl, responseCode = 204))
        nsInstrumentation.addHttpResponse(HttpResponse(httpsProbeUrl, responseCode = 204))
        nsInstrumentation.addHttpResponse(HttpResponse(httpsProbeUrl, responseCode = 204))


        val na = NetworkAgentWrapper(TRANSPORT_CELLULAR, LinkProperties(), context)
        val na = NetworkAgentWrapper(TRANSPORT_CELLULAR, LinkProperties(), null /* ncTemplate */,
                context)
        networkStackClient.verifyNetworkMonitorCreated(na.network, TEST_TIMEOUT_MS)
        networkStackClient.verifyNetworkMonitorCreated(na.network, TEST_TIMEOUT_MS)


        na.addCapability(NET_CAPABILITY_INTERNET)
        na.addCapability(NET_CAPABILITY_INTERNET)
@@ -238,7 +239,7 @@ class ConnectivityServiceIntegrationTest {


        val lp = LinkProperties()
        val lp = LinkProperties()
        lp.captivePortalApiUrl = Uri.parse(apiUrl)
        lp.captivePortalApiUrl = Uri.parse(apiUrl)
        val na = NetworkAgentWrapper(TRANSPORT_CELLULAR, lp, context)
        val na = NetworkAgentWrapper(TRANSPORT_CELLULAR, lp, null /* ncTemplate */, context)
        networkStackClient.verifyNetworkMonitorCreated(na.network, TEST_TIMEOUT_MS)
        networkStackClient.verifyNetworkMonitorCreated(na.network, TEST_TIMEOUT_MS)


        na.addCapability(NET_CAPABILITY_INTERNET)
        na.addCapability(NET_CAPABILITY_INTERNET)
+3 −3
Original line number Original line Diff line number Diff line
@@ -72,12 +72,12 @@ public class NetworkAgentWrapper implements TestableNetworkCallback.HasNetwork {
    private long mKeepaliveResponseDelay = 0L;
    private long mKeepaliveResponseDelay = 0L;
    private Integer mExpectedKeepaliveSlot = null;
    private Integer mExpectedKeepaliveSlot = null;


    public NetworkAgentWrapper(int transport, LinkProperties linkProperties, Context context)
    public NetworkAgentWrapper(int transport, LinkProperties linkProperties,
            throws Exception {
            NetworkCapabilities ncTemplate, Context context) throws Exception {
        final int type = transportToLegacyType(transport);
        final int type = transportToLegacyType(transport);
        final String typeName = ConnectivityManager.getNetworkTypeName(type);
        final String typeName = ConnectivityManager.getNetworkTypeName(type);
        mNetworkInfo = new NetworkInfo(type, 0, typeName, "Mock");
        mNetworkInfo = new NetworkInfo(type, 0, typeName, "Mock");
        mNetworkCapabilities = new NetworkCapabilities();
        mNetworkCapabilities = (ncTemplate != null) ? ncTemplate : new NetworkCapabilities();
        mNetworkCapabilities.addCapability(NET_CAPABILITY_NOT_SUSPENDED);
        mNetworkCapabilities.addCapability(NET_CAPABILITY_NOT_SUSPENDED);
        mNetworkCapabilities.addTransportType(transport);
        mNetworkCapabilities.addTransportType(transport);
        switch (transport) {
        switch (transport) {
+214 −286

File changed.

Preview size limit exceeded, changes collapsed.