Search in sources :

Example 6 with RepeatedPostprocessorConsumer

use of com.facebook.imagepipeline.producers.PostprocessorProducer.RepeatedPostprocessorConsumer in project fresco by facebook.

the class RepeatedPostprocessorProducerTest method testCannotPostprocessAfterPostprocessFailure.

@Test
public void testCannotPostprocessAfterPostprocessFailure() {
    RepeatedPostprocessorConsumer postprocessorConsumer = produceResults();
    RepeatedPostprocessorRunner repeatedPostprocessorRunner = getRunner();
    performNewResult(postprocessorConsumer, true);
    verifyNewResultProcessed(0);
    performFailure(repeatedPostprocessorRunner);
    mInOrder.verify(mProducerListener).onProducerStart(mProducerContext, PostprocessorProducer.NAME);
    mInOrder.verify(mPostprocessor).process(mSourceBitmap, mPlatformBitmapFactory);
    mInOrder.verify(mProducerListener).requiresExtraMap(mProducerContext, PostprocessorProducer.NAME);
    mInOrder.verify(mProducerListener).onProducerFinishWithFailure(eq(mProducerContext), eq(PostprocessorProducer.NAME), any(RuntimeException.class), eq(mExtraMap));
    mInOrder.verify(mConsumer).onFailure(any(RuntimeException.class));
    mInOrder.verifyNoMoreInteractions();
    // Can't update now that the request has failed.
    performUpdate(repeatedPostprocessorRunner, true);
    mInOrder.verifyNoMoreInteractions();
    performCancelAfterFinished();
    verify(mSourceCloseableStaticBitmap).close();
}
Also used : RepeatedPostprocessorConsumer(com.facebook.imagepipeline.producers.PostprocessorProducer.RepeatedPostprocessorConsumer) RepeatedPostprocessorRunner(com.facebook.imagepipeline.request.RepeatedPostprocessorRunner)

Example 7 with RepeatedPostprocessorConsumer

use of com.facebook.imagepipeline.producers.PostprocessorProducer.RepeatedPostprocessorConsumer in project fresco by facebook.

the class RepeatedPostprocessorProducerTest method testUpdateBeforeNewResultDoesNothing.

@Test
public void testUpdateBeforeNewResultDoesNothing() {
    RepeatedPostprocessorConsumer postprocessorConsumer = produceResults();
    RepeatedPostprocessorRunner repeatedPostprocessorRunner = getRunner();
    performUpdate(repeatedPostprocessorRunner, true);
    performUpdate(repeatedPostprocessorRunner, true);
    mInOrder.verifyNoMoreInteractions();
    performNewResult(postprocessorConsumer, true);
    verifyNewResultProcessed(0);
}
Also used : RepeatedPostprocessorConsumer(com.facebook.imagepipeline.producers.PostprocessorProducer.RepeatedPostprocessorConsumer) RepeatedPostprocessorRunner(com.facebook.imagepipeline.request.RepeatedPostprocessorRunner)

Aggregations

RepeatedPostprocessorConsumer (com.facebook.imagepipeline.producers.PostprocessorProducer.RepeatedPostprocessorConsumer)7 RepeatedPostprocessorRunner (com.facebook.imagepipeline.request.RepeatedPostprocessorRunner)7 Bitmap (android.graphics.Bitmap)1 CloseableReference (com.facebook.common.references.CloseableReference)1 CloseableAnimatedImage (com.facebook.imagepipeline.image.CloseableAnimatedImage)1 CloseableImage (com.facebook.imagepipeline.image.CloseableImage)1 CloseableStaticBitmap (com.facebook.imagepipeline.image.CloseableStaticBitmap)1