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

Commit a04286be authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Rewrite testBadApkOnly_Phase3 (1/n)"

parents fdc9134e 94b0adcf
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -21,8 +21,6 @@ import static com.android.cts.rollback.lib.RollbackUtils.getUniqueRollbackInfoFo

import static com.google.common.truth.Truth.assertThat;

import static org.junit.Assert.fail;

import android.Manifest;
import android.annotation.Nullable;
import android.content.ComponentName;
@@ -155,10 +153,9 @@ public class StagedRollbackTest {
        RollbackUtils.sendCrashBroadcast(TestApp.A, 1);

        // We expect the device to be rebooted automatically. Wait for that to happen.
        Thread.sleep(30 * 1000);

        // Raise an error anyway if reboot didn't happen.
        fail("watchdog did not trigger reboot");
        // This device method will fail and the host will catch the assertion.
        // If reboot doesn't happen, the host will fail the assertion.
        Thread.sleep(TimeUnit.SECONDS.toMillis(120));
    }

    /**
+1 −12
Original line number Diff line number Diff line
@@ -19,8 +19,6 @@ package com.android.tests.rollback.host;
import static org.junit.Assert.assertTrue;
import static org.testng.Assert.assertThrows;

import com.android.ddmlib.Log.LogLevel;
import com.android.tradefed.log.LogUtil.CLog;
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;

@@ -57,17 +55,8 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
        runPhase("testBadApkOnly_Phase1");
        getDevice().reboot();
        runPhase("testBadApkOnly_Phase2");
        try {
            // This is expected to fail due to the device being rebooted out
            // from underneath the test. If this fails for reasons other than
            // the device reboot, those failures should result in failure of
            // the testApkOnlyConfirmRollback phase.
            CLog.logAndDisplay(LogLevel.INFO, "testBadApkOnlyTriggerRollback is expected to fail");
            runPhase("testBadApkOnly_Phase3");
        } catch (AssertionError e) {
            // AssertionError is expected.
        }

        assertThrows(AssertionError.class, () -> runPhase("testBadApkOnly_Phase3"));
        getDevice().waitForDeviceAvailable();

        runPhase("testBadApkOnly_Phase4");