Search in sources :

Example 16 with Request

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();
}
Also used : Request(com.bumptech.glide.request.Request) Test(org.junit.Test)

Example 17 with Request

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();
}
Also used : Request(com.bumptech.glide.request.Request) Test(org.junit.Test)

Example 18 with Request

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();
}
Also used : Request(com.bumptech.glide.request.Request) Test(org.junit.Test)

Example 19 with Request

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();
}
Also used : Request(com.bumptech.glide.request.Request) Test(org.junit.Test)

Example 20 with Request

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;
}
Also used : Request(com.bumptech.glide.request.Request) SingleRequest(com.bumptech.glide.request.SingleRequest)

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