Loading tests/src/com/android/launcher3/util/RaceConditionReproducerTest.java +7 −3 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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"); Loading Loading @@ -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()); Loading tests/src/com/android/launcher3/util/TraceHelperForTest.java +5 −0 Original line number Diff line number Diff line Loading @@ -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 Loading
tests/src/com/android/launcher3/util/RaceConditionReproducerTest.java +7 −3 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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"); Loading Loading @@ -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()); Loading
tests/src/com/android/launcher3/util/TraceHelperForTest.java +5 −0 Original line number Diff line number Diff line Loading @@ -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