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

Commit 8abb4a17 authored by Piotr Wilczyński's avatar Piotr Wilczyński
Browse files

Improve error handling in TopologyUpdateDeliveryTest

Bug: 430133965
Bug: 391855929
Test: TopologyUpdateDeliveryTest
Flag: EXEMPT bugfix
Change-Id: I4991ca3f2e321de15f05ac5163d044e07da5ae03
parent edc0b13d
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ public abstract class EventDeliveryTestBase {
                    mContext.startActivity(intent);
                },
                android.Manifest.permission.START_ACTIVITIES_FROM_SDK_SANDBOX);
        waitLatch(mLatchActivityLaunch);
        waitLatch(mLatchActivityLaunch, "Failed to launch test activity");

        try {
            String cmd = "pidof " + getTestPackage();
@@ -202,7 +202,7 @@ public abstract class EventDeliveryTestBase {
                    mInstrumentation.startActivitySync(intent2);
                },
                android.Manifest.permission.START_ACTIVITIES_FROM_SDK_SANDBOX);
        waitLatch(mLatchActivityCached);
        waitLatch(mLatchActivityCached, "Failed to make test activity cached");
    }

    // Sleep, ignoring interrupts.
@@ -249,9 +249,11 @@ public abstract class EventDeliveryTestBase {
    /**
     * Wait for CountDownLatch with timeout
     */
    private void waitLatch(CountDownLatch latch) {
    private void waitLatch(CountDownLatch latch, String errorMsg) {
        try {
            latch.await(TEST_FAILURE_TIMEOUT_MSEC, TimeUnit.MILLISECONDS);
            if (!latch.await(TEST_FAILURE_TIMEOUT_MSEC, TimeUnit.MILLISECONDS)) {
                fail(errorMsg);
            }
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }