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

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

Make MockVpn more realistic and easier to use. am: f3d35fde

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

Change-Id: I0e1ff975206ed180744c4c7a6f42e00b95589424
parents f4c6750c f3d35fde
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -195,7 +195,8 @@ class ConnectivityServiceIntegrationTest {
                "https://secure.test.android.com",
                responseCode = 204, contentLength = 42, redirectUrl = null))

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

        na.addCapability(NET_CAPABILITY_INTERNET)
+3 −3
Original line number Diff line number Diff line
@@ -69,12 +69,12 @@ public class NetworkAgentWrapper implements TestableNetworkCallback.HasNetwork {
    private int mStopKeepaliveError = SocketKeepalive.NO_KEEPALIVE;
    private Integer mExpectedKeepaliveSlot = null;

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

File changed.

Preview size limit exceeded, changes collapsed.