Search in sources :

Example 31 with Request

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

the class RequestTrackerTest method testPausesIncompleteRequestsOnRestartIfPaused.

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

Example 32 with Request

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

the class RequestTrackerTest method testClearRemoveAndRecycle_withTrackedRequest_clearsRecyclesAndReturnsTrue.

@Test
public void testClearRemoveAndRecycle_withTrackedRequest_clearsRecyclesAndReturnsTrue() {
    Request request = mock(Request.class);
    tracker.addRequest(request);
    assertThat(tracker.clearRemoveAndRecycle(request)).isTrue();
    verify(request).clear();
    verify(request).recycle();
}
Also used : Request(com.bumptech.glide.request.Request) Test(org.junit.Test)

Example 33 with Request

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

the class RequestTrackerTest method testCanAddMultipleRequests.

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

Example 34 with Request

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

the class RequestTrackerTest method testClearRemoveAndRecycle_withUnTrackedRequest_doesNothingAndReturnsFalse.

@Test
public void testClearRemoveAndRecycle_withUnTrackedRequest_doesNothingAndReturnsFalse() {
    Request request = mock(Request.class);
    assertThat(tracker.clearRemoveAndRecycle(request)).isFalse();
    verify(request, never()).clear();
    verify(request, never()).recycle();
}
Also used : Request(com.bumptech.glide.request.Request) Test(org.junit.Test)

Example 35 with Request

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

the class RequestTrackerTest method testStartsRequestAddedWhenPausedWhenResumed.

@Test
public void testStartsRequestAddedWhenPausedWhenResumed() {
    Request request = mock(Request.class);
    tracker.pauseRequests();
    tracker.runRequest(request);
    tracker.resumeRequests();
    verify(request).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