use of com.facebook.imagepipeline.memory.BitmapCounter in project fresco by facebook.
the class GingerbreadPurgeableDecoderTest method setUp.
@Before
public void setUp() {
mBitmap = MockBitmapFactory.create();
mBitmapCounter = new BitmapCounter(MAX_BITMAP_COUNT, MAX_BITMAP_SIZE);
mockStatic(BitmapCounterProvider.class);
when(BitmapCounterProvider.get()).thenReturn(mBitmapCounter);
mockStatic(BitmapFactory.class);
when(BitmapFactory.decodeFileDescriptor(any(FileDescriptor.class), any(Rect.class), any(BitmapFactory.Options.class))).thenReturn(mBitmap);
mInputBuf = new byte[LENGTH];
PooledByteBuffer input = new TrivialPooledByteBuffer(mInputBuf, POINTER);
mByteBufferRef = CloseableReference.of(input);
mEncodedImage = new EncodedImage(mByteBufferRef);
mDecodeBuf = new byte[LENGTH + 2];
mDecodeBufRef = CloseableReference.of(mDecodeBuf, mock(ResourceReleaser.class));
mockStatic(Bitmaps.class);
mGingerbreadPurgeableDecoder = new GingerbreadPurgeableDecoder();
}
use of com.facebook.imagepipeline.memory.BitmapCounter in project fresco by facebook.
the class KitKatPurgeableDecoderTest method setUp.
@Before
public void setUp() {
mFlexByteArrayPool = mock(FlexByteArrayPool.class);
mBitmap = MockBitmapFactory.create();
mBitmapCounter = new BitmapCounter(MAX_BITMAP_COUNT, MAX_BITMAP_SIZE);
mockStatic(BitmapCounterProvider.class);
when(BitmapCounterProvider.get()).thenReturn(mBitmapCounter);
mockStatic(BitmapFactory.class);
when(BitmapFactory.decodeByteArray(any(byte[].class), anyInt(), anyInt(), any(BitmapFactory.Options.class))).thenReturn(mBitmap);
mInputBuf = new byte[LENGTH];
PooledByteBuffer input = new TrivialPooledByteBuffer(mInputBuf, POINTER);
mByteBufferRef = CloseableReference.of(input);
mEncodedImage = new EncodedImage(mByteBufferRef);
mDecodeBuf = new byte[LENGTH + 2];
mDecodeBufRef = CloseableReference.of(mDecodeBuf, mock(ResourceReleaser.class));
when(mFlexByteArrayPool.get(Integer.valueOf(LENGTH))).thenReturn(mDecodeBufRef);
mockStatic(Bitmaps.class);
mKitKatPurgeableDecoder = new KitKatPurgeableDecoder(mFlexByteArrayPool);
}
Aggregations