@Test public void testOnErrorEventEmitted () { verify(mEventEmitter, never()).receiveEvent(anyInt(), anyString(), any(WritableMap.class)); WebImageViewTarget target = new WebImageViewTarget(mImageView); mViewManager.mRequestListener.onLoadFailed(new GlideException("some error"), null, target, true); WritableMap expectedEvent = new JavaOnlyMap(); expectedEvent.putString("uri", "http: expectedEvent.putString("error", "some error"); verify(mEventEmitter).receiveEvent(-1, "onWebImageError", expectedEvent); }
@Override public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource) { WebImageView view = null; if (target instanceof WebImageViewTarget) { view = ((WebImageViewTarget) target).getView(); } if (view != null) { ThemedReactContext context = view.getThemedReactContext(); if (context != null) { WritableMap event = createMap(); if (e != null) { event.putString("error", e.getMessage()); } else { event.putString("error", "Unknown"); } final GlideUrl uri = view.getImageUri(); if (uri != null) { event.putString("uri", uri.toStringUrl()); } context.getJSModule(RCTEventEmitter.class).receiveEvent(view.getId(), "onWebImageError", event); } } return false; }
RequestListener implements com.bumptech.glide.request.RequestListener { @Override public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource) { WebImageView view = null; if (target instanceof WebImageViewTarget) { view = ((WebImageViewTarget) target).getView(); } if (view != null) { ThemedReactContext context = view.getThemedReactContext(); if (context != null) { WritableMap event = createMap(); if (e != null) { event.putString("error", e.getMessage()); } else { event.putString("error", "Unknown"); } final GlideUrl uri = view.getImageUri(); if (uri != null) { event.putString("uri", uri.toStringUrl()); } context.getJSModule(RCTEventEmitter.class).receiveEvent(view.getId(), "onWebImageError", event); } } return false; } }
RequestListener implements com.bumptech.glide.request.RequestListener { @Override public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource) { WebImageView view = null; if (target instanceof WebImageViewTarget) { view = ((WebImageViewTarget) target).getView(); } if (view != null) { ThemedReactContext context = view.getThemedReactContext(); if (context != null) { WritableMap event = createMap(); if (e != null) { event.putString("error", e.getMessage()); } else { event.putString("error", "Unknown"); } final GlideUrl uri = view.getImageUri(); if (uri != null) { event.putString("uri", uri.toStringUrl()); } context.getJSModule(RCTEventEmitter.class).receiveEvent(view.getId(), "onWebImageError", event); } } return false; }  }
RequestListener implements com.bumptech.glide.request.RequestListener { @Override public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource) { WebImageView view = null; if (target instanceof WebImageViewTarget) { view = ((WebImageViewTarget) target).getView(); } if (view != null) { ThemedReactContext context = view.getThemedReactContext(); if (context != null) { WritableMap event = createMap(); if (e != null) { event.putString("error", e.getMessage()); } else { event.putString("error", "Unknown"); } final GlideUrl uri = view.getImageUri(); if (uri != null) { event.putString("uri", uri.toStringUrl()); } context.getJSModule(RCTEventEmitter.class).receiveEvent(view.getId(), "onWebImageError", event); } } return false; }  @Override boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource); @Override boolean onResourceReady(Object resource, Object model, Target target, DataSource dataSource, boolean isFirstResource); }
RequestListener implements com.bumptech.glide.request.RequestListener { @Override public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource) { WebImageView view = null; if (target instanceof WebImageViewTarget) { view = ((WebImageViewTarget) target).getView(); } if (view != null) { ThemedReactContext context = view.getThemedReactContext(); if (context != null) { WritableMap event = createMap(); if (e != null) { event.putString("error", e.getMessage()); } else { event.putString("error", "Unknown"); } final GlideUrl uri = view.getImageUri(); if (uri != null) { event.putString("uri", uri.toStringUrl()); } context.getJSModule(RCTEventEmitter.class).receiveEvent(view.getId(), "onWebImageError", event); } } return false; }  @Override boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource); @Override boolean onResourceReady(Object resource, Object model, Target target, DataSource dataSource, boolean isFirstResource);  }