use of com.facebook.imagepipeline.testing.FakeClock in project fresco by facebook.
the class RepeatedPostprocessorProducerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mTestExecutorService = new TestExecutorService(new FakeClock());
mPostprocessorProducer = new PostprocessorProducer(mInputProducer, mPlatformBitmapFactory, mTestExecutorService);
mProducerContext = new SettableProducerContext(mImageRequest, mRequestId, mProducerListener, mock(Object.class), ImageRequest.RequestLevel.FULL_FETCH, false, /* isPrefetch */
false, /* isIntermediateResultExpected */
Priority.MEDIUM, mConfig);
when(mImageRequest.getPostprocessor()).thenReturn(mPostprocessor);
mResults = new ArrayList<>();
when(mPostprocessor.getName()).thenReturn(POSTPROCESSOR_NAME);
when(mProducerListener.requiresExtraMap(mProducerContext, PRODUCER_NAME)).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), anyInt());
mInOrder = inOrder(mPostprocessor, mProducerListener, mConsumer);
}
use of com.facebook.imagepipeline.testing.FakeClock 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, mConfig);
mTestExecutorService = new TestExecutorService(new FakeClock());
mThreadHandoffProducer = new ThreadHandoffProducer(mInputProducer, new ThreadHandoffProducerQueueImpl(mTestExecutorService));
mImagePipelineExperiments = mock(ImagePipelineExperiments.class);
doReturn(mImagePipelineExperiments).when(mConfig).getExperiments();
doReturn(false).when(mImagePipelineExperiments).getHandOffOnUiThreadOnly();
}
Aggregations