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

Commit c17f50f8 authored by Charles He's avatar Charles He
Browse files

Unbreak VPN unit tests.

VpnTest was broken earlier due to a change to always-on VPN
notifications. This CL adds the corresponding mocks to the unit test to
fix it.

Bug: 36650087
Bug: 65439160
Test: runtest frameworks-net
Change-Id: Icff57c7e927c135d75a7d70ff347a579c5d45134
Merged-In: Icff57c7e927c135d75a7d70ff347a579c5d45134
(cherry picked from commit 3da6a1fc)
parent ab6f2f62
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.UserInfo;
import android.content.res.Resources;
import android.net.NetworkInfo.DetailedState;
import android.net.UidRange;
import android.os.Build;
@@ -43,6 +44,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import android.util.ArrayMap;
import android.util.ArraySet;

import com.android.internal.R;
import com.android.internal.net.VpnConfig;

import java.util.ArrayList;
@@ -113,6 +115,9 @@ public class VpnTest extends AndroidTestCase {
        when(mContext.getSystemService(eq(Context.APP_OPS_SERVICE))).thenReturn(mAppOps);
        when(mContext.getSystemService(eq(Context.NOTIFICATION_SERVICE)))
                .thenReturn(mNotificationManager);
        when(mContext.getString(R.string.config_customVpnAlwaysOnDisconnectedDialogComponent))
                .thenReturn(Resources.getSystem().getString(
                        R.string.config_customVpnAlwaysOnDisconnectedDialogComponent));

        // Used by {@link Notification.Builder}
        ApplicationInfo applicationInfo = new ApplicationInfo();