use of com.bumptech.glide.load.Key in project glide by bumptech.
the class ActiveResourcesTest method queueIdle_withQueuedReferenceDeactivated_doesNotNotifyListener.
@Test
public void queueIdle_withQueuedReferenceDeactivated_doesNotNotifyListener() {
EngineResource<Object> engineResource = new EngineResource<>(resource, /*isCacheable=*/
true, /*isRecyclable=*/
true);
resources.activate(key, engineResource);
ResourceWeakReference weakRef = resources.activeEngineResources.get(key);
CountDownLatch latch = getLatchForClearedRef();
weakRef.enqueue();
resources.deactivate(key);
waitForLatch(latch);
verify(listener, never()).onResourceReleased(any(Key.class), any(EngineResource.class));
}
use of com.bumptech.glide.load.Key in project glide by bumptech.
the class ActiveResourcesTest method queueIdle_afterReferenceQueuedThenReactivated_doesNotNotifyListener.
@Test
public void queueIdle_afterReferenceQueuedThenReactivated_doesNotNotifyListener() {
EngineResource<Object> first = new EngineResource<>(resource, /*isCacheable=*/
true, /*isRecyclable=*/
true);
resources.activate(key, first);
ResourceWeakReference weakRef = resources.activeEngineResources.get(key);
CountDownLatch latch = getLatchForClearedRef();
weakRef.enqueue();
EngineResource<Object> second = new EngineResource<>(resource, /*isCacheable=*/
true, /*isRecyclable=*/
true);
resources.activate(key, second);
waitForLatch(latch);
verify(listener, never()).onResourceReleased(any(Key.class), any(EngineResource.class));
}
use of com.bumptech.glide.load.Key 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.Key in project glide by bumptech.
the class ApplicationVersionSignatureTest method testMissingPackageInfo.
@Test
public void testMissingPackageInfo() throws NameNotFoundException {
Context context = mock(Context.class, Answers.RETURNS_DEEP_STUBS.get());
String packageName = "my.package";
when(context.getPackageName()).thenReturn(packageName);
when(context.getPackageManager().getPackageInfo(packageName, 0)).thenReturn(null);
Key key = ApplicationVersionSignature.obtain(context);
assertNotNull(key);
}
Aggregations