Search in sources :

Example 6 with Request

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

the class RequestTrackerTest method testDoesNotStartStartedRequestsWhenResumed.

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

Example 7 with Request

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

the class RequestTrackerTest method testRestartsFailedRequestRestart.

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

Example 8 with Request

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

the class RequestTrackerTest method testAvoidsConcurrentModificationWhenResuming.

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

Example 9 with Request

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

the class RequestTrackerTest method testDoesNotClearFailedRequestsWhenPaused.

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

Example 10 with Request

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

the class RequestTrackerTest method testDoesNotStartRequestOnRunIfPaused.

@Test
public void testDoesNotStartRequestOnRunIfPaused() {
    Request request = mock(Request.class);
    tracker.pauseRequests();
    tracker.runRequest(request);
    verify(request, never()).begin();
}
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