@Test public void preRenderHtml_shouldPreloadTheHtml() throws Exception { String htmlData = "this is nonsense"; MoPubActivity.preRenderHtml(subject, mockAdReport, customEventInterstitialListener, htmlData); verify(htmlInterstitialWebView).enablePlugins(eq(false)); verify(htmlInterstitialWebView).loadHtmlResponse(htmlData); }
static void preRenderHtml(final Context context, final AdReport adReport, final CustomEventInterstitialListener customEventInterstitialListener, String htmlData) { HtmlInterstitialWebView dummyWebView = HtmlInterstitialWebViewFactory.create(context, adReport, customEventInterstitialListener, false, null, null); dummyWebView.enablePlugins(false); dummyWebView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (url.equals(MOPUB_FINISH_LOAD)) { customEventInterstitialListener.onInterstitialLoaded(); } else if (url.equals(MOPUB_FAIL_LOAD)) { customEventInterstitialListener.onInterstitialFailed(null); } return true; } }); dummyWebView.loadHtmlResponse(htmlData); }
MoPubActivity extends BaseInterstitialActivity { static void preRenderHtml(final Context context, final AdReport adReport, final CustomEventInterstitialListener customEventInterstitialListener, String htmlData) { HtmlInterstitialWebView dummyWebView = HtmlInterstitialWebViewFactory.create(context, adReport, customEventInterstitialListener, false, null, null); dummyWebView.enablePlugins(false); dummyWebView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (url.equals(MOPUB_FINISH_LOAD)) { customEventInterstitialListener.onInterstitialLoaded(); } else if (url.equals(MOPUB_FAIL_LOAD)) { customEventInterstitialListener.onInterstitialFailed(null); } return true; } }); dummyWebView.loadHtmlResponse(htmlData); } }
MoPubActivity extends BaseInterstitialActivity { static void preRenderHtml(final Context context, final AdReport adReport, final CustomEventInterstitialListener customEventInterstitialListener, String htmlData) { HtmlInterstitialWebView dummyWebView = HtmlInterstitialWebViewFactory.create(context, adReport, customEventInterstitialListener, false, null, null); dummyWebView.enablePlugins(false); dummyWebView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (url.equals(MOPUB_FINISH_LOAD)) { customEventInterstitialListener.onInterstitialLoaded(); } else if (url.equals(MOPUB_FAIL_LOAD)) { customEventInterstitialListener.onInterstitialFailed(null); } return true; } }); dummyWebView.loadHtmlResponse(htmlData); }  }
MoPubActivity extends BaseInterstitialActivity { static void preRenderHtml(final Context context, final AdReport adReport, final CustomEventInterstitialListener customEventInterstitialListener, String htmlData) { HtmlInterstitialWebView dummyWebView = HtmlInterstitialWebViewFactory.create(context, adReport, customEventInterstitialListener, false, null, null); dummyWebView.enablePlugins(false); dummyWebView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (url.equals(MOPUB_FINISH_LOAD)) { customEventInterstitialListener.onInterstitialLoaded(); } else if (url.equals(MOPUB_FAIL_LOAD)) { customEventInterstitialListener.onInterstitialFailed(null); } return true; } }); dummyWebView.loadHtmlResponse(htmlData); }  static void start(Context context, String htmlData, AdReport adReport,
            boolean isScrollable, String redirectUrl, String clickthroughUrl,
            CreativeOrientation creativeOrientation, long broadcastIdentifier); @Override View getAdView(); }
MoPubActivity extends BaseInterstitialActivity { static void preRenderHtml(final Context context, final AdReport adReport, final CustomEventInterstitialListener customEventInterstitialListener, String htmlData) { HtmlInterstitialWebView dummyWebView = HtmlInterstitialWebViewFactory.create(context, adReport, customEventInterstitialListener, false, null, null); dummyWebView.enablePlugins(false); dummyWebView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (url.equals(MOPUB_FINISH_LOAD)) { customEventInterstitialListener.onInterstitialLoaded(); } else if (url.equals(MOPUB_FAIL_LOAD)) { customEventInterstitialListener.onInterstitialFailed(null); } return true; } }); dummyWebView.loadHtmlResponse(htmlData); }  static void start(Context context, String htmlData, AdReport adReport,
            boolean isScrollable, String redirectUrl, String clickthroughUrl,
            CreativeOrientation creativeOrientation, long broadcastIdentifier); @Override View getAdView();  }