parent
26628eeb4b
commit
301eeaa976
|
@ -30,11 +30,12 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||||
public class PrioritizedSerialExecutorTests extends AndroidTestCase {
|
public class PrioritizedSerialExecutorTests extends AndroidTestCase {
|
||||||
private static final String TAG = PrioritizedSerialExecutorTests.class.getSimpleName();
|
private static final String TAG = PrioritizedSerialExecutorTests.class.getSimpleName();
|
||||||
|
|
||||||
|
private static final String TEST_EXECUTOR_ID = "test";
|
||||||
private static final int NUM_OF_TASKS = 10;
|
private static final int NUM_OF_TASKS = 10;
|
||||||
private static final int DELAY_FOR_WAITING_TASKS_MILLISECONDS = 500;
|
private static final int DELAY_FOR_WAITING_TASKS_MILLISECONDS = 500;
|
||||||
|
|
||||||
public void testExecute() {
|
public void testExecute() {
|
||||||
final PrioritizedSerialExecutor executor = new PrioritizedSerialExecutor();
|
final PrioritizedSerialExecutor executor = new PrioritizedSerialExecutor(TEST_EXECUTOR_ID);
|
||||||
final AtomicInteger v = new AtomicInteger(0);
|
final AtomicInteger v = new AtomicInteger(0);
|
||||||
for (int i = 0; i < NUM_OF_TASKS; ++i) {
|
for (int i = 0; i < NUM_OF_TASKS; ++i) {
|
||||||
executor.execute(new Runnable() {
|
executor.execute(new Runnable() {
|
||||||
|
@ -54,7 +55,7 @@ public class PrioritizedSerialExecutorTests extends AndroidTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testExecutePrioritized() {
|
public void testExecutePrioritized() {
|
||||||
final PrioritizedSerialExecutor executor = new PrioritizedSerialExecutor();
|
final PrioritizedSerialExecutor executor = new PrioritizedSerialExecutor(TEST_EXECUTOR_ID);
|
||||||
final AtomicInteger v = new AtomicInteger(0);
|
final AtomicInteger v = new AtomicInteger(0);
|
||||||
for (int i = 0; i < NUM_OF_TASKS; ++i) {
|
for (int i = 0; i < NUM_OF_TASKS; ++i) {
|
||||||
executor.executePrioritized(new Runnable() {
|
executor.executePrioritized(new Runnable() {
|
||||||
|
@ -74,7 +75,7 @@ public class PrioritizedSerialExecutorTests extends AndroidTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testExecuteCombined() {
|
public void testExecuteCombined() {
|
||||||
final PrioritizedSerialExecutor executor = new PrioritizedSerialExecutor();
|
final PrioritizedSerialExecutor executor = new PrioritizedSerialExecutor(TEST_EXECUTOR_ID);
|
||||||
final AtomicInteger v = new AtomicInteger(0);
|
final AtomicInteger v = new AtomicInteger(0);
|
||||||
for (int i = 0; i < NUM_OF_TASKS; ++i) {
|
for (int i = 0; i < NUM_OF_TASKS; ++i) {
|
||||||
executor.execute(new Runnable() {
|
executor.execute(new Runnable() {
|
||||||
|
|
Loading…
Reference in New Issue