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

Commit e5468f75 authored by Gustav Sennton's avatar Gustav Sennton
Browse files

Fix WebViewUpdateService test expectation to match reality.

Update testTargetSdkVersionValidity to use the same minimum sdk as the
actual code it's testing.

Bug: 69554263
Test: run com.android.server.webkit.WebViewUpdateServiceTest tests.

Change-Id: Ide04ede774072a10b84a9726bdff536bfef12712
parent 8362c6d2
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@ public class UserPackage {
    private final UserInfo mUserInfo;
    private final PackageInfo mPackageInfo;

    public static final int MINIMUM_SUPPORTED_SDK = Build.VERSION_CODES.O_MR1;

    public UserPackage(UserInfo user, PackageInfo packageInfo) {
        this.mUserInfo = user;
        this.mPackageInfo = packageInfo;
@@ -83,7 +85,7 @@ public class UserPackage {
     * supported by the current framework version.
     */
    public static boolean hasCorrectTargetSdkVersion(PackageInfo packageInfo) {
        return packageInfo.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.O_MR1;
        return packageInfo.applicationInfo.targetSdkVersion >= MINIMUM_SUPPORTED_SDK;
    }

    public UserInfo getUserInfo() {
+3 −2
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.MediumTest;
import android.util.Base64;
import android.webkit.UserPackage;
import android.webkit.WebViewFactory;
import android.webkit.WebViewProviderInfo;
import android.webkit.WebViewProviderResponse;
@@ -1628,10 +1629,10 @@ public class WebViewUpdateServiceTest {
        newSdkPackage.applicationInfo.targetSdkVersion = Build.VERSION_CODES.CUR_DEVELOPMENT;
        PackageInfo currentSdkPackage = createPackageInfo("currentTargetSdkPackage",
            true /* enabled */, true /* valid */, true /* installed */);
        currentSdkPackage.applicationInfo.targetSdkVersion = Build.VERSION_CODES.N_MR1+1;
        currentSdkPackage.applicationInfo.targetSdkVersion = UserPackage.MINIMUM_SUPPORTED_SDK;
        PackageInfo oldSdkPackage = createPackageInfo("oldTargetSdkPackage",
            true /* enabled */, true /* valid */, true /* installed */);
        oldSdkPackage.applicationInfo.targetSdkVersion = Build.VERSION_CODES.N_MR1;
        oldSdkPackage.applicationInfo.targetSdkVersion = UserPackage.MINIMUM_SUPPORTED_SDK - 1;

        WebViewProviderInfo newSdkProviderInfo =
                new WebViewProviderInfo(newSdkPackage.packageName, "", true, false, null);