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

Commit 7b292f6e authored by Lee Shombert's avatar Lee Shombert Committed by Android (Google) Code Review
Browse files

Merge "Remove obsolete AnrTimer Java code" into main

parents a2cb765c 29ec3f25
Loading
Loading
Loading
Loading
+67 −650

File changed.

Preview size limit exceeded, changes collapsed.

+27 −0
Original line number Diff line number Diff line
@@ -30,13 +30,19 @@ import androidx.test.filters.SmallTest;
import com.android.internal.annotations.GuardedBy;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

@SmallTest
@Presubmit
@RunWith(Parameterized.class)
public class AnrTimerTest {

    // The commonly used message timeout key.
@@ -105,6 +111,16 @@ public class AnrTimerTest {
        }
    }

    /**
     * Force AnrTimer to use the test parameter for the feature flag.
     */
    class TestInjector extends AnrTimer.Injector {
        @Override
        boolean anrTimerServiceEnabled() {
            return mEnabled;
        }
    }

    /**
     * An instrumented AnrTimer.
     */
@@ -137,6 +153,17 @@ public class AnrTimerTest {
        assertEquals(actual.what, MSG_TIMEOUT);
    }

    @Parameters(name = "featureEnabled={0}")
    public static Collection<Object[]> data() {
        return Arrays.asList(new Object[][] { {false}, {true} });
    }

    /** True if the feature is enabled. */
    private boolean mEnabled;

    public AnrTimerTest(boolean featureEnabled) {
        mEnabled = featureEnabled;
    }

    /**
     * Verify that a simple expiration succeeds.  The timer is started for 10ms.  The test