Fix encoded memory cache producer test
@@ -107,14 +107,21 @@ public class EncodedMemoryCacheProducerTest {
when(mImagePipelineConfig.getExperiments()).thenReturn(mImagePipelineExperiments);
when(mImagePipelineExperiments.isEncodedCacheEnabled()).thenReturn(true);
- when(mImageRequest.isMemoryCacheEnabled()).thenReturn(true);
+ setUpCacheEnabled(true);
+ }
+
+ private void setUpCacheEnabled(boolean enabled) {
+ when(mImageRequest.isCacheEnabled(ImageRequest.CachesLocationsMasks.ENCODED_READ))
+ .thenReturn(enabled);
+ when(mImageRequest.isCacheEnabled(ImageRequest.CachesLocationsMasks.ENCODED_WRITE))
+ .thenReturn(enabled);
}
@Test
public void testDisableMemoryCache() {
setupEncodedMemoryCacheGetNotFound();
setupInputProducerStreamingSuccess();
- when(mImageRequest.isMemoryCacheEnabled()).thenReturn(false);
+ setUpCacheEnabled(false);
mEncodedMemoryCacheProducer.produceResults(mConsumer, mProducerContext);
verify(mMemoryCache, never()).cache(any(CacheKey.class), any(CloseableReference.class));
}
