use of com.bumptech.glide.request.Request in project glide by bumptech.
the class RequestTrackerTest method testStartsRequestOnRun.
@Test
public void testStartsRequestOnRun() {
Request request = mock(Request.class);
tracker.runRequest(request);
verify(request).begin();
}
use of com.bumptech.glide.request.Request in project glide by bumptech.
the class RequestTrackerTest method testClearsAddedRequestsOnDestroy.
@Test
public void testClearsAddedRequestsOnDestroy() {
Request request = mock(Request.class);
tracker.addRequest(request);
tracker.clearRequests();
verify(request).clear();
verify(request).recycle();
}
use of com.bumptech.glide.request.Request in project glide by bumptech.
the class RequestTrackerTest method testPausesInProgressRequestsWhenPaused.
@Test
public void testPausesInProgressRequestsWhenPaused() {
Request request = mock(Request.class);
when(request.isRunning()).thenReturn(true);
tracker.addRequest(request);
tracker.pauseRequests();
verify(request).pause();
}
use of com.bumptech.glide.request.Request in project glide by bumptech.
the class RequestTrackerTest method testPausesAndRestartsNotYetFinishedRequestsOnRestart.
@Test
public void testPausesAndRestartsNotYetFinishedRequestsOnRestart() {
Request request = mock(Request.class);
when(request.isComplete()).thenReturn(false);
tracker.addRequest(request);
tracker.restartRequests();
verify(request).pause();
verify(request).begin();
}
use of com.bumptech.glide.request.Request in project glide by bumptech.
the class RequestBuilder method into.
/**
* Set the target the resource will be loaded into.
*
* @param target The target to load the resource into.
* @return The given target.
* @see RequestManager#clear(Target)
*/
public <Y extends Target<TranscodeType>> Y into(@NonNull Y target) {
Util.assertMainThread();
Preconditions.checkNotNull(target);
if (!isModelSet) {
throw new IllegalArgumentException("You must call #load() before calling #into()");
}
Request previous = target.getRequest();
if (previous != null) {
requestManager.clear(target);
}
requestOptions.lock();
Request request = buildRequest(target);
target.setRequest(request);
requestManager.track(target, request);
return target;
}
Aggregations