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

Commit 00110ed7 authored by Omer Nebil Yaveroglu's avatar Omer Nebil Yaveroglu
Browse files

Fix broken tests caused by the fix on autohashing certificates (that

results in double hashing).

Bug: 148955753
Test: atest frameworks/base/core/tests/coretests/src/android/content/integrity
Change-Id: I77cbba8a4f3edb7cfeb844823c260589ffda194e
parent c73377de
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -90,18 +90,18 @@ public class AtomicFormulaTest {
    }

    @Test
    public void testValidAtomicFormula_stringValue_appCertificateAutoHashed() {
    public void testValidAtomicFormula_stringValue_appCertificateIsNotAutoHashed() {
        String appCert = "cert";
        StringAtomicFormula stringAtomicFormula =
                new StringAtomicFormula(AtomicFormula.APP_CERTIFICATE, appCert);

        assertThat(stringAtomicFormula.getKey()).isEqualTo(AtomicFormula.APP_CERTIFICATE);
        assertThat(stringAtomicFormula.getValue()).doesNotMatch(appCert);
        assertThat(stringAtomicFormula.getIsHashedValue()).isTrue();
        assertThat(stringAtomicFormula.getValue()).matches(appCert);
        assertThat(stringAtomicFormula.getIsHashedValue()).isFalse();
    }

    @Test
    public void testValidAtomicFormula_stringValue_installerCertificateAutoHashed() {
    public void testValidAtomicFormula_stringValue_installerCertificateIsNotAutoHashed() {
        String installerCert = "cert";
        StringAtomicFormula stringAtomicFormula =
                new StringAtomicFormula(AtomicFormula.INSTALLER_CERTIFICATE,
@@ -109,8 +109,8 @@ public class AtomicFormulaTest {

        assertThat(stringAtomicFormula.getKey()).isEqualTo(
                AtomicFormula.INSTALLER_CERTIFICATE);
        assertThat(stringAtomicFormula.getValue()).doesNotMatch(installerCert);
        assertThat(stringAtomicFormula.getIsHashedValue()).isTrue();
        assertThat(stringAtomicFormula.getValue()).matches(installerCert);
        assertThat(stringAtomicFormula.getIsHashedValue()).isFalse();
    }

    @Test
+6 −6
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ public class IntegrityFormulaTest {

        assertThat(stringAtomicFormula.getKey()).isEqualTo(AtomicFormula.PACKAGE_NAME);
        assertThat(stringAtomicFormula.getValue()).isEqualTo(packageName);
        assertThat(stringAtomicFormula.getIsHashedValue()).isEqualTo(false);
        assertThat(stringAtomicFormula.getIsHashedValue()).isFalse();
    }

    @Test
@@ -53,8 +53,8 @@ public class IntegrityFormulaTest {
                (AtomicFormula.StringAtomicFormula) formula;

        assertThat(stringAtomicFormula.getKey()).isEqualTo(AtomicFormula.APP_CERTIFICATE);
        assertThat(stringAtomicFormula.getValue()).doesNotMatch(appCertificate);
        assertThat(stringAtomicFormula.getIsHashedValue()).isEqualTo(true);
        assertThat(stringAtomicFormula.getValue()).matches(appCertificate);
        assertThat(stringAtomicFormula.getIsHashedValue()).isFalse();
    }

    @Test
@@ -68,7 +68,7 @@ public class IntegrityFormulaTest {

        assertThat(stringAtomicFormula.getKey()).isEqualTo(AtomicFormula.INSTALLER_NAME);
        assertThat(stringAtomicFormula.getValue()).isEqualTo(installerName);
        assertThat(stringAtomicFormula.getIsHashedValue()).isEqualTo(false);
        assertThat(stringAtomicFormula.getIsHashedValue()).isFalse();
    }

    @Test
@@ -81,8 +81,8 @@ public class IntegrityFormulaTest {
                (AtomicFormula.StringAtomicFormula) formula;

        assertThat(stringAtomicFormula.getKey()).isEqualTo(AtomicFormula.INSTALLER_CERTIFICATE);
        assertThat(stringAtomicFormula.getValue()).doesNotMatch(installerCertificate);
        assertThat(stringAtomicFormula.getIsHashedValue()).isEqualTo(true);
        assertThat(stringAtomicFormula.getValue()).matches(installerCertificate);
        assertThat(stringAtomicFormula.getIsHashedValue()).isFalse();
    }

    @Test