use of com.bumptech.glide.manager.Lifecycle in project glide by bumptech.
the class GlideTest method setUp.
@Before
public void setUp() throws Exception {
Glide.tearDown();
RobolectricPackageManager pm = RuntimeEnvironment.getRobolectricPackageManager();
ApplicationInfo info = pm.getApplicationInfo(RuntimeEnvironment.application.getPackageName(), 0);
info.metaData = new Bundle();
info.metaData.putString(SetupModule.class.getName(), "GlideModule");
// Ensure that target's size ready callback will be called synchronously.
target = mock(Target.class);
imageView = new ImageView(RuntimeEnvironment.application);
imageView.setLayoutParams(new ViewGroup.LayoutParams(100, 100));
doAnswer(new CallSizeReady()).when(target).getSize(isA(SizeReadyCallback.class));
Handler bgHandler = mock(Handler.class);
when(bgHandler.post(isA(Runnable.class))).thenAnswer(new Answer<Boolean>() {
@Override
public Boolean answer(InvocationOnMock invocation) throws Throwable {
Runnable runnable = (Runnable) invocation.getArguments()[0];
runnable.run();
return true;
}
});
Lifecycle lifecycle = mock(Lifecycle.class);
RequestManagerTreeNode treeNode = mock(RequestManagerTreeNode.class);
requestManager = new RequestManager(Glide.get(getContext()), lifecycle, treeNode);
requestManager.resumeRequests();
}
Aggregations