Java 类com.facebook.imagepipeline.producers.ProducerContext 实例源码

项目:GitHub    文件:ImagePipelineTest.java   
@Test
public void testPrefetchToBitmapCache() {
  Producer<Void> prefetchProducerSequence = mock(Producer.class);
  when(mProducerSequenceFactory.getDecodedImagePrefetchProducerSequence(mImageRequest))
      .thenReturn(prefetchProducerSequence);
  DataSource<Void> dataSource =
      mImagePipeline.prefetchToBitmapCache(mImageRequest, mCallerContext);
  assertTrue(!dataSource.isFinished());
  verify(mRequestListener1).onRequestStart(mImageRequest, mCallerContext, "0",  true);
  verify(mRequestListener2).onRequestStart(mImageRequest, mCallerContext, "0", true);
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(prefetchProducerSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertFalse(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.MEDIUM);
}
项目:GitHub    文件:ImagePipelineTest.java   
@Test
public void testFetchDecodedImage() {
  Producer<CloseableReference<CloseableImage>> decodedSequence = mock(Producer.class);
  when(mProducerSequenceFactory.getDecodedImageProducerSequence(mImageRequest))
      .thenReturn(decodedSequence);
  DataSource<CloseableReference<CloseableImage>> dataSource =
      mImagePipeline.fetchDecodedImage(mImageRequest, mCallerContext);
  assertFalse(dataSource.isFinished());
  verify(mRequestListener1).onRequestStart(mImageRequest, mCallerContext, "0", false);
  verify(mRequestListener2).onRequestStart(mImageRequest, mCallerContext, "0", false);
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(decodedSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertTrue(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.HIGH);
}
项目:GitHub    文件:ImagePipelineTest.java   
@Test
public void testFetchDecodedImageWithRequestLevel() {
  Producer<CloseableReference<CloseableImage>> decodedSequence = mock(Producer.class);
  when(mProducerSequenceFactory.getDecodedImageProducerSequence(mImageRequest))
      .thenReturn(decodedSequence);
  DataSource<CloseableReference<CloseableImage>> dataSource =
      mImagePipeline.fetchDecodedImage(
          mImageRequest,
          mCallerContext,
          ImageRequest.RequestLevel.DISK_CACHE);
  assertFalse(dataSource.isFinished());
  verify(mRequestListener1).onRequestStart(mImageRequest, mCallerContext, "0", false);
  verify(mRequestListener2).onRequestStart(mImageRequest, mCallerContext, "0", false);
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(decodedSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertTrue(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.HIGH);
  assertEquals(
      producerContextArgumentCaptor.getValue().getLowestPermittedRequestLevel(),
      ImageRequest.RequestLevel.DISK_CACHE);
}
项目:GitHub    文件:ImagePipelineTest.java   
@Test
public void testFetchFromBitmapCacheDueToMethodCall() {
  Producer<CloseableReference<CloseableImage>> bitmapCacheSequence = mock(Producer.class);
  when(mProducerSequenceFactory.getDecodedImageProducerSequence(mImageRequest))
      .thenReturn(bitmapCacheSequence);
  mImagePipeline.fetchImageFromBitmapCache(mImageRequest, mCallerContext);
  verify(mRequestListener1).onRequestStart(mImageRequest, mCallerContext, "0", false);
  verify(mRequestListener2).onRequestStart(mImageRequest, mCallerContext, "0", false);
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(bitmapCacheSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertTrue(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.HIGH);
  assertEquals(
      producerContextArgumentCaptor.getValue().getLowestPermittedRequestLevel(),
      ImageRequest.RequestLevel.BITMAP_MEMORY_CACHE);
}
项目:GitHub    文件:ImagePipelineTest.java   
@Test
public void testFetchFromBitmapCacheDueToImageRequest() {
  Producer<CloseableReference<CloseableImage>> bitmapCacheSequence = mock(Producer.class);
  when(mImageRequest.getLowestPermittedRequestLevel())
      .thenReturn(ImageRequest.RequestLevel.BITMAP_MEMORY_CACHE);
  when(mProducerSequenceFactory.getDecodedImageProducerSequence(mImageRequest))
      .thenReturn(bitmapCacheSequence);
  mImagePipeline.fetchDecodedImage(mImageRequest, mCallerContext);
  verify(mRequestListener1).onRequestStart(mImageRequest, mCallerContext, "0",  false);
  verify(mRequestListener2).onRequestStart(mImageRequest, mCallerContext, "0", false);
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(bitmapCacheSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertTrue(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.HIGH);
  assertEquals(
      producerContextArgumentCaptor.getValue().getLowestPermittedRequestLevel(),
      ImageRequest.RequestLevel.BITMAP_MEMORY_CACHE);
}
项目:GitHub    文件:ImagePipelineTest.java   
@Test
public void testGetBitmapCacheGetSupplier() {
  Supplier<DataSource<CloseableReference<CloseableImage>>> dataSourceSupplier =
      mImagePipeline.getDataSourceSupplier(
          mImageRequest,
          mCallerContext,
          ImageRequest.RequestLevel.BITMAP_MEMORY_CACHE);
  Producer<CloseableReference<CloseableImage>> bitmapCacheSequence = mock(Producer.class);
  when(mProducerSequenceFactory.getDecodedImageProducerSequence(mImageRequest))
      .thenReturn(bitmapCacheSequence);
  dataSourceSupplier.get();
  verify(mRequestListener1).onRequestStart(mImageRequest, mCallerContext, "0",  false);
  verify(mRequestListener2).onRequestStart(mImageRequest, mCallerContext, "0", false);
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(bitmapCacheSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertTrue(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.HIGH);
}
项目:GitHub    文件:ImagePipelineTest.java   
@Test
public void testGetFullFetchSupplier() {
  Supplier<DataSource<CloseableReference<CloseableImage>>> dataSourceSupplier = mImagePipeline
      .getDataSourceSupplier(mImageRequest, mCallerContext, ImageRequest.RequestLevel.FULL_FETCH);
  Producer<CloseableReference<CloseableImage>> decodedSequence = mock(Producer.class);
  when(mProducerSequenceFactory.getDecodedImageProducerSequence(mImageRequest))
      .thenReturn(decodedSequence);
  DataSource<CloseableReference<CloseableImage>> dataSource = dataSourceSupplier.get();
  assertFalse(dataSource.isFinished());
  verify(mRequestListener1).onRequestStart(mImageRequest, mCallerContext, "0", false);
  verify(mRequestListener2).onRequestStart(mImageRequest, mCallerContext, "0", false);
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(decodedSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertTrue(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.HIGH);
}
项目:fresco    文件:ImagePipelineTest.java   
@Test
public void testPrefetchToBitmapCache() {
  Producer<Void> prefetchProducerSequence = mock(Producer.class);
  when(mProducerSequenceFactory.getDecodedImagePrefetchProducerSequence(mImageRequest))
      .thenReturn(prefetchProducerSequence);
  DataSource<Void> dataSource =
      mImagePipeline.prefetchToBitmapCache(mImageRequest, mCallerContext);
  assertTrue(!dataSource.isFinished());
  verify(mRequestListener1).onRequestStart(mImageRequest, mCallerContext, "0",  true);
  verify(mRequestListener2).onRequestStart(mImageRequest, mCallerContext, "0", true);
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(prefetchProducerSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertFalse(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.MEDIUM);
}
项目:fresco    文件:ImagePipelineTest.java   
@Test
public void testFetchDecodedImage() {
  Producer<CloseableReference<CloseableImage>> decodedSequence = mock(Producer.class);
  when(mProducerSequenceFactory.getDecodedImageProducerSequence(mImageRequest))
      .thenReturn(decodedSequence);
  DataSource<CloseableReference<CloseableImage>> dataSource =
      mImagePipeline.fetchDecodedImage(mImageRequest, mCallerContext);
  assertFalse(dataSource.isFinished());
  verify(mRequestListener1).onRequestStart(mImageRequest, mCallerContext, "0", false);
  verify(mRequestListener2).onRequestStart(mImageRequest, mCallerContext, "0", false);
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(decodedSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertTrue(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.HIGH);
}
项目:fresco    文件:ImagePipelineTest.java   
@Test
public void testFetchDecodedImageWithRequestLevel() {
  Producer<CloseableReference<CloseableImage>> decodedSequence = mock(Producer.class);
  when(mProducerSequenceFactory.getDecodedImageProducerSequence(mImageRequest))
      .thenReturn(decodedSequence);
  DataSource<CloseableReference<CloseableImage>> dataSource =
      mImagePipeline.fetchDecodedImage(
          mImageRequest,
          mCallerContext,
          ImageRequest.RequestLevel.DISK_CACHE);
  assertFalse(dataSource.isFinished());
  verify(mRequestListener1).onRequestStart(mImageRequest, mCallerContext, "0", false);
  verify(mRequestListener2).onRequestStart(mImageRequest, mCallerContext, "0", false);
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(decodedSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertTrue(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.HIGH);
  assertEquals(
      producerContextArgumentCaptor.getValue().getLowestPermittedRequestLevel(),
      ImageRequest.RequestLevel.DISK_CACHE);
}
项目:fresco    文件:ImagePipelineTest.java   
@Test
public void testFetchFromBitmapCacheDueToMethodCall() {
  Producer<CloseableReference<CloseableImage>> bitmapCacheSequence = mock(Producer.class);
  when(mProducerSequenceFactory.getDecodedImageProducerSequence(mImageRequest))
      .thenReturn(bitmapCacheSequence);
  mImagePipeline.fetchImageFromBitmapCache(mImageRequest, mCallerContext);
  verify(mRequestListener1).onRequestStart(mImageRequest, mCallerContext, "0", false);
  verify(mRequestListener2).onRequestStart(mImageRequest, mCallerContext, "0", false);
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(bitmapCacheSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertTrue(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.HIGH);
  assertEquals(
      producerContextArgumentCaptor.getValue().getLowestPermittedRequestLevel(),
      ImageRequest.RequestLevel.BITMAP_MEMORY_CACHE);
}
项目:fresco    文件:ImagePipelineTest.java   
@Test
public void testFetchFromBitmapCacheDueToImageRequest() {
  Producer<CloseableReference<CloseableImage>> bitmapCacheSequence = mock(Producer.class);
  when(mImageRequest.getLowestPermittedRequestLevel())
      .thenReturn(ImageRequest.RequestLevel.BITMAP_MEMORY_CACHE);
  when(mProducerSequenceFactory.getDecodedImageProducerSequence(mImageRequest))
      .thenReturn(bitmapCacheSequence);
  mImagePipeline.fetchDecodedImage(mImageRequest, mCallerContext);
  verify(mRequestListener1).onRequestStart(mImageRequest, mCallerContext, "0",  false);
  verify(mRequestListener2).onRequestStart(mImageRequest, mCallerContext, "0", false);
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(bitmapCacheSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertTrue(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.HIGH);
  assertEquals(
      producerContextArgumentCaptor.getValue().getLowestPermittedRequestLevel(),
      ImageRequest.RequestLevel.BITMAP_MEMORY_CACHE);
}
项目:fresco    文件:ImagePipelineTest.java   
@Test
public void testGetBitmapCacheGetSupplier() {
  Supplier<DataSource<CloseableReference<CloseableImage>>> dataSourceSupplier =
      mImagePipeline.getDataSourceSupplier(
          mImageRequest,
          mCallerContext,
          ImageRequest.RequestLevel.BITMAP_MEMORY_CACHE);
  Producer<CloseableReference<CloseableImage>> bitmapCacheSequence = mock(Producer.class);
  when(mProducerSequenceFactory.getDecodedImageProducerSequence(mImageRequest))
      .thenReturn(bitmapCacheSequence);
  dataSourceSupplier.get();
  verify(mRequestListener1).onRequestStart(mImageRequest, mCallerContext, "0",  false);
  verify(mRequestListener2).onRequestStart(mImageRequest, mCallerContext, "0", false);
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(bitmapCacheSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertTrue(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.HIGH);
}
项目:fresco    文件:ImagePipelineTest.java   
@Test
public void testGetFullFetchSupplier() {
  Supplier<DataSource<CloseableReference<CloseableImage>>> dataSourceSupplier = mImagePipeline
      .getDataSourceSupplier(mImageRequest, mCallerContext, ImageRequest.RequestLevel.FULL_FETCH);
  Producer<CloseableReference<CloseableImage>> decodedSequence = mock(Producer.class);
  when(mProducerSequenceFactory.getDecodedImageProducerSequence(mImageRequest))
      .thenReturn(decodedSequence);
  DataSource<CloseableReference<CloseableImage>> dataSource = dataSourceSupplier.get();
  assertFalse(dataSource.isFinished());
  verify(mRequestListener1).onRequestStart(mImageRequest, mCallerContext, "0", false);
  verify(mRequestListener2).onRequestStart(mImageRequest, mCallerContext, "0", false);
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(decodedSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertTrue(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.HIGH);
}
项目:GitHub    文件:ImagePipelineTest.java   
private void verifyPrefetchToDiskCache(
    DataSource<Void> dataSource,
    Producer<Void> prefetchProducerSequence,
    Priority priority) {
  assertFalse(dataSource.isFinished());
  verify(mRequestListener1).onRequestStart(mImageRequest, mCallerContext, "0", true);
  verify(mRequestListener2).onRequestStart(mImageRequest, mCallerContext, "0", true);
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(prefetchProducerSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertFalse(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(priority, producerContextArgumentCaptor.getValue().getPriority());
}
项目:GitHub    文件:ImagePipelineTest.java   
@Test
public void testFetchLocalEncodedImage() {
  Producer<CloseableReference<PooledByteBuffer>> encodedSequence = mock(Producer.class);
  when(mProducerSequenceFactory.getEncodedImageProducerSequence(mImageRequest))
      .thenReturn(encodedSequence);
  when(mImageRequest.getSourceUri()).thenReturn(Uri.parse("file:///local/file"));
  DataSource<CloseableReference<PooledByteBuffer>> dataSource =
      mImagePipeline.fetchEncodedImage(mImageRequest, mCallerContext);
  assertFalse(dataSource.isFinished());
  ArgumentCaptor<ImageRequest> argumentCaptor = ArgumentCaptor.forClass(ImageRequest.class);
  verify(mRequestListener1).onRequestStart(
      argumentCaptor.capture(),
      eq(mCallerContext),
      eq("0"),
      eq(false));
  ImageRequest capturedImageRequest = argumentCaptor.getValue();
  assertSame(mImageRequest.getSourceUri(), capturedImageRequest.getSourceUri());
  verify(mRequestListener2).onRequestStart(
      argumentCaptor.capture(),
      eq(mCallerContext),
      eq("0"),
      eq(false));
  capturedImageRequest = argumentCaptor.getValue();
  assertSame(mImageRequest.getSourceUri(), capturedImageRequest.getSourceUri());
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(encodedSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertTrue(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.HIGH);
}
项目:GitHub    文件:ImagePipelineTest.java   
@Test
public void testFetchNetworkEncodedImage() {
  Producer<CloseableReference<PooledByteBuffer>> encodedSequence = mock(Producer.class);
  when(mProducerSequenceFactory.getEncodedImageProducerSequence(mImageRequest))
      .thenReturn(encodedSequence);
  when(mImageRequest.getSourceUri()).thenReturn(Uri.parse("http://test"));
  DataSource<CloseableReference<PooledByteBuffer>> dataSource =
      mImagePipeline.fetchEncodedImage(mImageRequest, mCallerContext);
  assertFalse(dataSource.isFinished());
  ArgumentCaptor<ImageRequest> argumentCaptor = ArgumentCaptor.forClass(ImageRequest.class);
  verify(mRequestListener1).onRequestStart(
      argumentCaptor.capture(),
      eq(mCallerContext),
      eq("0"),
      eq(false));
  ImageRequest capturedImageRequest = argumentCaptor.getValue();
  assertSame(mImageRequest.getSourceUri(), capturedImageRequest.getSourceUri());
  verify(mRequestListener2).onRequestStart(
      argumentCaptor.capture(),
      eq(mCallerContext),
      eq("0"),
      eq(false));
  capturedImageRequest = argumentCaptor.getValue();
  assertSame(mImageRequest.getSourceUri(), capturedImageRequest.getSourceUri());
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(encodedSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertTrue(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.HIGH);
}
项目:fresco    文件:ImagePipelineTest.java   
private void verifyPrefetchToDiskCache(
    DataSource<Void> dataSource,
    Producer<Void> prefetchProducerSequence,
    Priority priority) {
  assertFalse(dataSource.isFinished());
  verify(mRequestListener1).onRequestStart(mImageRequest, mCallerContext, "0", true);
  verify(mRequestListener2).onRequestStart(mImageRequest, mCallerContext, "0", true);
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(prefetchProducerSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertFalse(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(priority, producerContextArgumentCaptor.getValue().getPriority());
}
项目:fresco    文件:ImagePipelineTest.java   
@Test
public void testFetchLocalEncodedImage() {
  Producer<CloseableReference<PooledByteBuffer>> encodedSequence = mock(Producer.class);
  when(mProducerSequenceFactory.getEncodedImageProducerSequence(mImageRequest))
      .thenReturn(encodedSequence);
  when(mImageRequest.getSourceUri()).thenReturn(Uri.parse("file:///local/file"));
  DataSource<CloseableReference<PooledByteBuffer>> dataSource =
      mImagePipeline.fetchEncodedImage(mImageRequest, mCallerContext);
  assertFalse(dataSource.isFinished());
  ArgumentCaptor<ImageRequest> argumentCaptor = ArgumentCaptor.forClass(ImageRequest.class);
  verify(mRequestListener1).onRequestStart(
      argumentCaptor.capture(),
      eq(mCallerContext),
      eq("0"),
      eq(false));
  ImageRequest capturedImageRequest = argumentCaptor.getValue();
  assertSame(mImageRequest.getSourceUri(), capturedImageRequest.getSourceUri());
  verify(mRequestListener2).onRequestStart(
      argumentCaptor.capture(),
      eq(mCallerContext),
      eq("0"),
      eq(false));
  capturedImageRequest = argumentCaptor.getValue();
  assertSame(mImageRequest.getSourceUri(), capturedImageRequest.getSourceUri());
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(encodedSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertTrue(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.HIGH);
}
项目:fresco    文件:ImagePipelineTest.java   
@Test
public void testFetchNetworkEncodedImage() {
  Producer<CloseableReference<PooledByteBuffer>> encodedSequence = mock(Producer.class);
  when(mProducerSequenceFactory.getEncodedImageProducerSequence(mImageRequest))
      .thenReturn(encodedSequence);
  when(mImageRequest.getSourceUri()).thenReturn(Uri.parse("http://test"));
  DataSource<CloseableReference<PooledByteBuffer>> dataSource =
      mImagePipeline.fetchEncodedImage(mImageRequest, mCallerContext);
  assertFalse(dataSource.isFinished());
  ArgumentCaptor<ImageRequest> argumentCaptor = ArgumentCaptor.forClass(ImageRequest.class);
  verify(mRequestListener1).onRequestStart(
      argumentCaptor.capture(),
      eq(mCallerContext),
      eq("0"),
      eq(false));
  ImageRequest capturedImageRequest = argumentCaptor.getValue();
  assertSame(mImageRequest.getSourceUri(), capturedImageRequest.getSourceUri());
  verify(mRequestListener2).onRequestStart(
      argumentCaptor.capture(),
      eq(mCallerContext),
      eq("0"),
      eq(false));
  capturedImageRequest = argumentCaptor.getValue();
  assertSame(mImageRequest.getSourceUri(), capturedImageRequest.getSourceUri());
  ArgumentCaptor<ProducerContext> producerContextArgumentCaptor =
      ArgumentCaptor.forClass(ProducerContext.class);
  verify(encodedSequence)
      .produceResults(any(Consumer.class), producerContextArgumentCaptor.capture());
  assertTrue(producerContextArgumentCaptor.getValue().isIntermediateResultExpected());
  assertEquals(producerContextArgumentCaptor.getValue().getPriority(), Priority.HIGH);
}
项目:GitHub    文件:OkHttpNetworkFetcher.java   
public OkHttpNetworkFetchState(
    Consumer<EncodedImage> consumer,
    ProducerContext producerContext) {
  super(consumer, producerContext);
}
项目:GitHub    文件:OkHttpNetworkFetcher.java   
@Override
public OkHttpNetworkFetchState createFetchState(
    Consumer<EncodedImage> consumer,
    ProducerContext context) {
  return new OkHttpNetworkFetchState(consumer, context);
}
项目:GitHub    文件:VolleyNetworkFetcher.java   
public VolleyNetworkFetchState(
    Consumer<EncodedImage> consumer,
    ProducerContext producerContext) {
  super(consumer, producerContext);
}
项目:GitHub    文件:VolleyNetworkFetcher.java   
@Override
public VolleyNetworkFetchState createFetchState(
    Consumer<EncodedImage> consumer,
    ProducerContext context) {
  return new VolleyNetworkFetchState(consumer, context);
}
项目:GitHub    文件:OkHttpNetworkFetcher.java   
public OkHttpNetworkFetchState(
    Consumer<EncodedImage> consumer,
    ProducerContext producerContext) {
  super(consumer, producerContext);
}
项目:GitHub    文件:OkHttpNetworkFetcher.java   
@Override
public OkHttpNetworkFetchState createFetchState(
    Consumer<EncodedImage> consumer,
    ProducerContext context) {
  return new OkHttpNetworkFetchState(consumer, context);
}
项目:PicKing    文件:OkHttpNetworkFetcher.java   
@Override
public OkHttpNetworkFetchState createFetchState(
        Consumer<EncodedImage> consumer,
        ProducerContext context) {
    return new OkHttpNetworkFetchState(consumer, context);
}
项目:PicKing    文件:OkHttpNetworkFetcher.java   
public OkHttpNetworkFetchState(
        Consumer<EncodedImage> consumer,
        ProducerContext producerContext) {
    super(consumer, producerContext);
}
项目:H-Viewer    文件:MyOkHttpNetworkFetcher.java   
@Override
public OkHttpNetworkFetchState createFetchState(
        Consumer<EncodedImage> consumer,
        ProducerContext context) {
    return new OkHttpNetworkFetchState(consumer, context);
}
项目:H-Viewer    文件:MyOkHttpNetworkFetcher.java   
public OkHttpNetworkFetchState(
        Consumer<EncodedImage> consumer,
        ProducerContext producerContext) {
    super(consumer, producerContext);
}
项目:fresco    文件:OkHttpNetworkFetcher.java   
public OkHttpNetworkFetchState(
    Consumer<EncodedImage> consumer,
    ProducerContext producerContext) {
  super(consumer, producerContext);
}
项目:fresco    文件:OkHttpNetworkFetcher.java   
@Override
public OkHttpNetworkFetchState createFetchState(
    Consumer<EncodedImage> consumer,
    ProducerContext context) {
  return new OkHttpNetworkFetchState(consumer, context);
}
项目:fresco    文件:VolleyNetworkFetcher.java   
public VolleyNetworkFetchState(
    Consumer<EncodedImage> consumer,
    ProducerContext producerContext) {
  super(consumer, producerContext);
}
项目:fresco    文件:VolleyNetworkFetcher.java   
@Override
public VolleyNetworkFetchState createFetchState(
    Consumer<EncodedImage> consumer,
    ProducerContext context) {
  return new VolleyNetworkFetchState(consumer, context);
}
项目:fresco    文件:OkHttpNetworkFetcher.java   
public OkHttpNetworkFetchState(
    Consumer<EncodedImage> consumer,
    ProducerContext producerContext) {
  super(consumer, producerContext);
}
项目:fresco    文件:OkHttpNetworkFetcher.java   
@Override
public OkHttpNetworkFetchState createFetchState(
    Consumer<EncodedImage> consumer,
    ProducerContext context) {
  return new OkHttpNetworkFetchState(consumer, context);
}