Пример #1
0
 @Test
 public void performSubmitWithShutdownServiceIgnoresRequest() {
   when(service.isShutdown()).thenReturn(true);
   Action action = mockAction(URI_KEY_1, URI_1);
   dispatcher.performSubmit(action);
   assertThat(dispatcher.hunterMap).isEmpty();
   verify(service, never()).submit(any(BitmapHunter.class));
 }
Пример #2
0
 @Test
 public void performRetrySkipIfServiceShutdown() {
   when(service.isShutdown()).thenReturn(true);
   BitmapHunter hunter = mockHunter(URI_KEY_1, bitmap1, false);
   dispatcher.performRetry(hunter);
   verify(service, never()).submit(hunter);
   assertThat(dispatcher.hunterMap).isEmpty();
   assertThat(dispatcher.failedActions).isEmpty();
 }
Пример #3
0
 void performNetworkStateChange(NetworkInfo info) {
   if (service instanceof PicassoExecutorService) {
     ((PicassoExecutorService) service).adjustThreadCount(info);
   }
   // Intentionally check only if isConnected() here before we flush out failed actions.
   if (info != null && info.isConnected()) {
     flushFailedActions();
   }
 }
Пример #4
0
 @Test
 public void performSubmitWithShutdownAttachesRequest() {
   BitmapHunter hunter = mockHunter(URI_KEY_1, bitmap1, false);
   dispatcher.hunterMap.put(URI_KEY_1, hunter);
   when(service.isShutdown()).thenReturn(true);
   Action action = mockAction(URI_KEY_1, URI_1);
   dispatcher.performSubmit(action);
   assertThat(dispatcher.hunterMap).hasSize(1);
   verify(hunter).attach(action);
   verify(service, never()).submit(any(BitmapHunter.class));
 }