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();
}
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();
}
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();
}
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();
}
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();
}
Aggregations