Cleaning up properly after RaceConditionReproducerTest
Change-Id: I43362fbc63789d3ce3468266a5189a9f9d209d00
This commit is contained in:
parent
377c5a3023
commit
bffbd7521d
|
@ -22,6 +22,7 @@ import static org.junit.Assert.assertTrue;
|
|||
import androidx.test.filters.LargeTest;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
@ -45,6 +46,11 @@ public class RaceConditionReproducerTest {
|
|||
eventProcessor = new RaceConditionReproducer();
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
TraceHelperForTest.cleanup();
|
||||
}
|
||||
|
||||
private void run3_3_TestAction() throws InterruptedException {
|
||||
Thread tb = new Thread(() -> {
|
||||
eventProcessor.onEvent("B1");
|
||||
|
@ -125,9 +131,7 @@ public class RaceConditionReproducerTest {
|
|||
@Test
|
||||
// 2 threads, 3 events each; reproducing a particular event sequence.
|
||||
public void test3_3_ReproMode() throws Exception {
|
||||
final RaceConditionReproducer eventProcessor = new RaceConditionReproducer(
|
||||
SOME_VALID_SEQUENCE_3_3);
|
||||
|
||||
eventProcessor = new RaceConditionReproducer(SOME_VALID_SEQUENCE_3_3);
|
||||
eventProcessor.startIteration();
|
||||
run3_3_TestAction();
|
||||
assertTrue(!eventProcessor.finishIteration());
|
||||
|
|
|
@ -33,6 +33,11 @@ public class TraceHelperForTest extends TraceHelper {
|
|||
INSTANCE_FOR_TEST.mRaceConditionReproducer = reproducer;
|
||||
}
|
||||
|
||||
public static void cleanup() {
|
||||
INSTANCE_FOR_TEST.mRaceConditionReproducer = null;
|
||||
INSTANCE_FOR_TEST.mFlagsChangeListener = null;
|
||||
}
|
||||
|
||||
public static void setFlagsChangeListener(IntConsumer listener) {
|
||||
TraceHelper.INSTANCE = INSTANCE_FOR_TEST;
|
||||
INSTANCE_FOR_TEST.mFlagsChangeListener = listener;
|
||||
|
|
Loading…
Reference in New Issue