@Test public void handleClick_withAboutBlankClickThroughUrl_shouldFailSilently() throws Exception { initializeSubject(); subject.handleClick(Arrays.asList("clicktracker"), "about:blank"); assertThat(Robolectric.getShadowApplication().getNextStartedActivity()).isNull(); }
@VisibleForTesting void handleClick(final List<String> clickThroughTrackers, final String clickThroughUrl) { makeTrackingHttpRequest(clickThroughTrackers, getContext(), BaseEvent.Name.CLICK_REQUEST); if (TextUtils.isEmpty(clickThroughUrl)) { return; } broadcastAction(ACTION_INTERSTITIAL_CLICK); new UrlHandler.Builder() .withSupportedUrlActions( UrlAction.IGNORE_ABOUT_SCHEME, UrlAction.OPEN_NATIVE_BROWSER, UrlAction.OPEN_IN_APP_BROWSER, UrlAction.HANDLE_SHARE_TWEET) .withResultActions(new UrlHandler.ResultActions() { @Override public void urlHandlingSucceeded(@NonNull String url, @NonNull UrlAction urlAction) { if (urlAction == UrlAction.OPEN_IN_APP_BROWSER) { Bundle bundle = new Bundle(); bundle.putString(MoPubBrowser.DESTINATION_URL_KEY, clickThroughUrl); getBaseVideoViewControllerListener().onStartActivityForResult( MoPubBrowser.class, MOPUB_BROWSER_REQUEST_CODE, bundle); } } @Override public void urlHandlingFailed(@NonNull String url, @NonNull UrlAction lastFailedUrlAction) { } }) .withoutMoPubBrowser() .build().handleUrl(getContext(), clickThroughUrl); }
VastVideoViewController extends BaseVideoViewController implements DownloadTask.DownloadTaskListener { @VisibleForTesting void handleClick(final List<String> clickThroughTrackers, final String clickThroughUrl) { makeTrackingHttpRequest(clickThroughTrackers, getContext(), BaseEvent.Name.CLICK_REQUEST); if (TextUtils.isEmpty(clickThroughUrl)) { return; } broadcastAction(ACTION_INTERSTITIAL_CLICK); new UrlHandler.Builder() .withSupportedUrlActions( UrlAction.IGNORE_ABOUT_SCHEME, UrlAction.OPEN_NATIVE_BROWSER, UrlAction.OPEN_IN_APP_BROWSER, UrlAction.HANDLE_SHARE_TWEET) .withResultActions(new UrlHandler.ResultActions() { @Override public void urlHandlingSucceeded(@NonNull String url, @NonNull UrlAction urlAction) { if (urlAction == UrlAction.OPEN_IN_APP_BROWSER) { Bundle bundle = new Bundle(); bundle.putString(MoPubBrowser.DESTINATION_URL_KEY, clickThroughUrl); getBaseVideoViewControllerListener().onStartActivityForResult( MoPubBrowser.class, MOPUB_BROWSER_REQUEST_CODE, bundle); } } @Override public void urlHandlingFailed(@NonNull String url, @NonNull UrlAction lastFailedUrlAction) { } }) .withoutMoPubBrowser() .build().handleUrl(getContext(), clickThroughUrl); } }
VastVideoViewController extends BaseVideoViewController implements DownloadTask.DownloadTaskListener { @VisibleForTesting void handleClick(final List<String> clickThroughTrackers, final String clickThroughUrl) { makeTrackingHttpRequest(clickThroughTrackers, getContext(), BaseEvent.Name.CLICK_REQUEST); if (TextUtils.isEmpty(clickThroughUrl)) { return; } broadcastAction(ACTION_INTERSTITIAL_CLICK); new UrlHandler.Builder() .withSupportedUrlActions( UrlAction.IGNORE_ABOUT_SCHEME, UrlAction.OPEN_NATIVE_BROWSER, UrlAction.OPEN_IN_APP_BROWSER, UrlAction.HANDLE_SHARE_TWEET) .withResultActions(new UrlHandler.ResultActions() { @Override public void urlHandlingSucceeded(@NonNull String url, @NonNull UrlAction urlAction) { if (urlAction == UrlAction.OPEN_IN_APP_BROWSER) { Bundle bundle = new Bundle(); bundle.putString(MoPubBrowser.DESTINATION_URL_KEY, clickThroughUrl); getBaseVideoViewControllerListener().onStartActivityForResult( MoPubBrowser.class, MOPUB_BROWSER_REQUEST_CODE, bundle); } } @Override public void urlHandlingFailed(@NonNull String url, @NonNull UrlAction lastFailedUrlAction) { } }) .withoutMoPubBrowser() .build().handleUrl(getContext(), clickThroughUrl); } VastVideoViewController(final Context context,
            final Bundle bundle,
            final long broadcastIdentifier,
            final BaseVideoViewControllerListener baseVideoViewControllerListener); }
VastVideoViewController extends BaseVideoViewController implements DownloadTask.DownloadTaskListener { @VisibleForTesting void handleClick(final List<String> clickThroughTrackers, final String clickThroughUrl) { makeTrackingHttpRequest(clickThroughTrackers, getContext(), BaseEvent.Name.CLICK_REQUEST); if (TextUtils.isEmpty(clickThroughUrl)) { return; } broadcastAction(ACTION_INTERSTITIAL_CLICK); new UrlHandler.Builder() .withSupportedUrlActions( UrlAction.IGNORE_ABOUT_SCHEME, UrlAction.OPEN_NATIVE_BROWSER, UrlAction.OPEN_IN_APP_BROWSER, UrlAction.HANDLE_SHARE_TWEET) .withResultActions(new UrlHandler.ResultActions() { @Override public void urlHandlingSucceeded(@NonNull String url, @NonNull UrlAction urlAction) { if (urlAction == UrlAction.OPEN_IN_APP_BROWSER) { Bundle bundle = new Bundle(); bundle.putString(MoPubBrowser.DESTINATION_URL_KEY, clickThroughUrl); getBaseVideoViewControllerListener().onStartActivityForResult( MoPubBrowser.class, MOPUB_BROWSER_REQUEST_CODE, bundle); } } @Override public void urlHandlingFailed(@NonNull String url, @NonNull UrlAction lastFailedUrlAction) { } }) .withoutMoPubBrowser() .build().handleUrl(getContext(), clickThroughUrl); } VastVideoViewController(final Context context,
            final Bundle bundle,
            final long broadcastIdentifier,
            final BaseVideoViewControllerListener baseVideoViewControllerListener); @Override boolean backButtonEnabled(); @Override void onComplete(String url, DownloadResponse downloadResponse); }
VastVideoViewController extends BaseVideoViewController implements DownloadTask.DownloadTaskListener { @VisibleForTesting void handleClick(final List<String> clickThroughTrackers, final String clickThroughUrl) { makeTrackingHttpRequest(clickThroughTrackers, getContext(), BaseEvent.Name.CLICK_REQUEST); if (TextUtils.isEmpty(clickThroughUrl)) { return; } broadcastAction(ACTION_INTERSTITIAL_CLICK); new UrlHandler.Builder() .withSupportedUrlActions( UrlAction.IGNORE_ABOUT_SCHEME, UrlAction.OPEN_NATIVE_BROWSER, UrlAction.OPEN_IN_APP_BROWSER, UrlAction.HANDLE_SHARE_TWEET) .withResultActions(new UrlHandler.ResultActions() { @Override public void urlHandlingSucceeded(@NonNull String url, @NonNull UrlAction urlAction) { if (urlAction == UrlAction.OPEN_IN_APP_BROWSER) { Bundle bundle = new Bundle(); bundle.putString(MoPubBrowser.DESTINATION_URL_KEY, clickThroughUrl); getBaseVideoViewControllerListener().onStartActivityForResult( MoPubBrowser.class, MOPUB_BROWSER_REQUEST_CODE, bundle); } } @Override public void urlHandlingFailed(@NonNull String url, @NonNull UrlAction lastFailedUrlAction) { } }) .withoutMoPubBrowser() .build().handleUrl(getContext(), clickThroughUrl); } VastVideoViewController(final Context context,
            final Bundle bundle,
            final long broadcastIdentifier,
            final BaseVideoViewControllerListener baseVideoViewControllerListener); @Override boolean backButtonEnabled(); @Override void onComplete(String url, DownloadResponse downloadResponse);  }