Search in sources :

Example 11 with Request

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

the class RequestTrackerTest method testDoesRestartFailedRequestsWhenResumed.

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

Example 12 with Request

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

the class RequestTrackerTest method testDoesNotClearCompleteRequestsWhenPaused.

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

Example 13 with Request

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

the class RequestTrackerTest method testCanAddAndRemoveRequest.

@Test
public void testCanAddAndRemoveRequest() {
    Request request = mock(Request.class);
    tracker.addRequest(request);
    tracker.clearRemoveAndRecycle(request);
    tracker.clearRequests();
    verify(request, times(1)).clear();
}
Also used : Request(com.bumptech.glide.request.Request) Test(org.junit.Test)

Example 14 with Request

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

the class RequestTrackerTest method testRestartsStoppedRequestWhenResumed.

@Test
public void testRestartsStoppedRequestWhenResumed() {
    Request request = mock(Request.class);
    tracker.addRequest(request);
    tracker.resumeRequests();
    verify(request).begin();
}
Also used : Request(com.bumptech.glide.request.Request) Test(org.junit.Test)

Example 15 with Request

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

the class RequestTrackerTest method testClearRemoveAndRecycle_withAlreadyRemovedRequest_doesNothingAndReturnsFalse.

@Test
public void testClearRemoveAndRecycle_withAlreadyRemovedRequest_doesNothingAndReturnsFalse() {
    Request request = mock(Request.class);
    tracker.addRequest(request);
    tracker.clearRemoveAndRecycle(request);
    assertThat(tracker.clearRemoveAndRecycle(request)).isFalse();
    verify(request, times(1)).clear();
    verify(request, times(1)).recycle();
}
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