use of com.facebook.imagepipeline.testing.FakeClock in project fresco by facebook.
the class AnimatedDrawableTest method setup.
@Before
public void setup() {
mFakeClock = new FakeClock();
mTestScheduledExecutorService = new TestScheduledExecutorService(mFakeClock);
mBackend = new TestAnimatedDrawableBackend(WIDTH, HEIGHT, FRAME_DURATIONS);
mCachingBackend = new TestAnimatedDrawableCachingBackend(mBackend);
mCallback = new MyCallback(mFakeClock);
mDrawable = new AnimatedDrawable(mTestScheduledExecutorService, mCachingBackend, AnimatedDrawableDiagnosticsNoop.getInstance(), mFakeClock);
mDrawable.setCallback(mCallback);
}
use of com.facebook.imagepipeline.testing.FakeClock in project fresco by facebook.
the class AnimatedRepeatedPostprocessorProducerTest 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);
when(mImageRequest.getPostprocessor()).thenReturn(mPostprocessor);
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);
}
use of com.facebook.imagepipeline.testing.FakeClock in project fresco by facebook.
the class AnimatedDrawableSupportTest method setup.
@Before
public void setup() {
mFakeClock = new FakeClock();
mTestScheduledExecutorService = new TestScheduledExecutorService(mFakeClock);
mBackend = new TestAnimatedDrawableSupportBackend(WIDTH, HEIGHT, FRAME_DURATIONS);
mCachingBackend = new TestAnimatedDrawableCachingBackend(mBackend);
mCallback = new MyCallback(mFakeClock);
mDrawable = new AnimatedDrawableSupport(mTestScheduledExecutorService, mCachingBackend, AnimatedDrawableDiagnosticsNoop.getInstance(), mFakeClock);
mDrawable.setCallback(mCallback);
}
use of com.facebook.imagepipeline.testing.FakeClock in project fresco by facebook.
the class LocalContentUriFetchProducerTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
mExecutor = new TestExecutorService(new FakeClock());
mLocalContentUriFetchProducer = new LocalContentUriFetchProducer(mExecutor, mPooledByteBufferFactory, mContentResolver);
mContentUri = Uri.fromFile(mock(File.class));
mProducerContext = new SettableProducerContext(mImageRequest, mRequestId, mProducerListener, mock(Object.class), ImageRequest.RequestLevel.FULL_FETCH, false, true, Priority.MEDIUM);
when(mImageRequest.getSourceUri()).thenReturn(mContentUri);
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
mCapturedEncodedImage = EncodedImage.cloneOrNull((EncodedImage) invocation.getArguments()[0]);
return null;
}
}).when(mConsumer).onNewResult(notNull(EncodedImage.class), anyBoolean());
}
use of com.facebook.imagepipeline.testing.FakeClock in project fresco by facebook.
the class LocalContentUriThumbnailFetchProducerTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
mExecutor = new TestExecutorService(new FakeClock());
mLocalContentUriThumbnailFetchProducer = new LocalContentUriThumbnailFetchProducer(mExecutor, mPooledByteBufferFactory, mContentResolver);
mContentUri = Uri.parse("content://media/external/images/media/1");
mProducerContext = new SettableProducerContext(mImageRequest, mRequestId, mProducerListener, mock(Object.class), ImageRequest.RequestLevel.FULL_FETCH, false, true, Priority.MEDIUM);
when(mImageRequest.getSourceUri()).thenReturn(mContentUri);
mockMediaStoreCursor();
mockThumbnailFile();
mockContentResolver();
}
Aggregations