Search in sources :

Example 36 with Request

use of com.bumptech.glide.request.Request in project glide by bumptech.

the class RequestTrackerTest method testPausesFailedRequestOnRestartIfPaused.

@Test
public void testPausesFailedRequestOnRestartIfPaused() {
    Request request = mock(Request.class);
    when(request.isFailed()).thenReturn(true);
    tracker.pauseRequests();
    tracker.addRequest(request);
    tracker.restartRequests();
    verify(request).pause();
}
Also used : Request(com.bumptech.glide.request.Request) Test(org.junit.Test)

Example 37 with Request

use of com.bumptech.glide.request.Request in project glide by bumptech.

the class RequestTrackerTest method testDoesNotBeginIncompleteRequestsOnRestartIfPaused.

@Test
public void testDoesNotBeginIncompleteRequestsOnRestartIfPaused() {
    Request request = mock(Request.class);
    when(request.isFailed()).thenReturn(false);
    when(request.isComplete()).thenReturn(false);
    tracker.pauseRequests();
    tracker.addRequest(request);
    tracker.restartRequests();
    verify(request, never()).begin();
}
Also used : Request(com.bumptech.glide.request.Request) Test(org.junit.Test)

Example 38 with Request

use of com.bumptech.glide.request.Request in project glide by bumptech.

the class RequestTrackerTest method testDoesNotBeginFailedRequestOnRestartIfPaused.

@Test
public void testDoesNotBeginFailedRequestOnRestartIfPaused() {
    Request request = mock(Request.class);
    when(request.isFailed()).thenReturn(true);
    tracker.pauseRequests();
    tracker.addRequest(request);
    tracker.restartRequests();
    verify(request, never()).begin();
}
Also used : Request(com.bumptech.glide.request.Request) Test(org.junit.Test)

Example 39 with Request

use of com.bumptech.glide.request.Request in project glide by bumptech.

the class RequestTrackerTest method testAvoidsConcurrentModificationWhenClearing.

@Test
public void testAvoidsConcurrentModificationWhenClearing() {
    Request first = mock(Request.class);
    Request second = mock(Request.class);
    doAnswer(new ClearAndRemoveRequest(second)).when(first).clear();
    tracker.addRequest(mock(Request.class));
    tracker.addRequest(first);
    tracker.addRequest(second);
    tracker.clearRequests();
}
Also used : Request(com.bumptech.glide.request.Request) Test(org.junit.Test)

Aggregations

Request (com.bumptech.glide.request.Request)39 Test (org.junit.Test)33 DelayTarget (com.bumptech.glide.load.resource.gif.GifFrameLoader.DelayTarget)3 SingleRequest (com.bumptech.glide.request.SingleRequest)2 Nullable (android.support.annotation.Nullable)1 View (android.view.View)1 BaseRequestOptions (com.bumptech.glide.request.BaseRequestOptions)1 ThumbnailRequestCoordinator (com.bumptech.glide.request.ThumbnailRequestCoordinator)1 ShadowView (org.robolectric.shadows.ShadowView)1