use of com.facebook.imagepipeline.testing.TestExecutorService in project fresco by facebook.
the class SingleUsePostprocessorProducerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mTestExecutorService = new TestExecutorService(new FakeClock());
mPostprocessorProducer = new PostprocessorProducer(mInputProducer, mPlatformBitmapFactory, mTestExecutorService);
when(mImageRequest.getPostprocessor()).thenReturn(mPostprocessor);
when(mProducerContext.getId()).thenReturn(mRequestId);
when(mProducerContext.getListener()).thenReturn(mProducerListener);
when(mProducerContext.getImageRequest()).thenReturn(mImageRequest);
mResults = new ArrayList<>();
when(mPostprocessor.getName()).thenReturn(POSTPROCESSOR_NAME);
when(mProducerListener.requiresExtraMap(mRequestId)).thenReturn(true);
doAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
mResults.add(((CloseableReference<CloseableImage>) invocation.getArguments()[0]).clone());
return null;
}
}).when(mConsumer).onNewResult(any(CloseableReference.class), anyBoolean());
mInOrder = inOrder(mPostprocessor, mProducerListener, mConsumer);
mSourceBitmap = mock(Bitmap.class);
mSourceCloseableStaticBitmap = mock(CloseableStaticBitmap.class);
when(mSourceCloseableStaticBitmap.getUnderlyingBitmap()).thenReturn(mSourceBitmap);
mSourceCloseableImageRef = CloseableReference.<CloseableImage>of(mSourceCloseableStaticBitmap);
mDestinationBitmap = mock(Bitmap.class);
mDestinationCloseableBitmapRef = CloseableReference.of(mDestinationBitmap, mBitmapResourceReleaser);
}
use of com.facebook.imagepipeline.testing.TestExecutorService in project fresco by facebook.
the class ThreadHandoffProducerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mProducerContext = new SettableProducerContext(mImageRequest, mRequestId, mProducerListener, mock(Object.class), ImageRequest.RequestLevel.FULL_FETCH, false, true, Priority.MEDIUM);
mTestExecutorService = new TestExecutorService(new FakeClock());
mThreadHandoffProducer = new ThreadHandoffProducer(mInputProducer, new ThreadHandoffProducerQueue(mTestExecutorService));
}
Aggregations