use of com.bumptech.glide.load.engine.ActiveResources.ResourceWeakReference in project glide by bumptech.
the class ActiveResourcesTest method queueIdle_withCacheableResourceInActive_removesResourceFromActive.
@Test
public void queueIdle_withCacheableResourceInActive_removesResourceFromActive() throws InterruptedException {
EngineResource<Object> engineResource = new EngineResource<>(resource, /*isCacheable=*/
true, /*isRecyclable=*/
true);
resources.activate(key, engineResource);
ResourceWeakReference weakRef = resources.activeEngineResources.get(key);
enqueueAndWaitForRef(weakRef);
assertThat(resources.get(key)).isNull();
}
use of com.bumptech.glide.load.engine.ActiveResources.ResourceWeakReference in project glide by bumptech.
the class ActiveResourcesTest method get_withQueuedReference_doesNotNotifyListener.
@Test
public void get_withQueuedReference_doesNotNotifyListener() {
EngineResource<Object> engineResource = new EngineResource<>(resource, /*isCacheable=*/
true, /*isRecyclable=*/
true);
resources.activate(key, engineResource);
ResourceWeakReference weakRef = resources.activeEngineResources.get(key);
weakRef.enqueue();
verify(listener, never()).onResourceReleased(any(Key.class), any(EngineResource.class));
}
use of com.bumptech.glide.load.engine.ActiveResources.ResourceWeakReference in project glide by bumptech.
the class ActiveResourcesTest method get_withQueuedReference_retentionDisabled_returnsResource.
@Test
public void get_withQueuedReference_retentionDisabled_returnsResource() {
resources = new ActiveResources(/*isActiveResourceRetentionAllowed=*/
false);
EngineResource<Object> engineResource = new EngineResource<>(resource, /*isCacheable=*/
true, /*isRecyclable=*/
true);
resources.activate(key, engineResource);
ResourceWeakReference weakRef = resources.activeEngineResources.get(key);
weakRef.enqueue();
assertThat(resources.get(key)).isEqualTo(engineResource);
}
Aggregations