use of org.prebid.mobile.rendering.views.webview.PrebidWebViewBase in project prebid-mobile-android by prebid.
the class MraidClose method addWebViewToContainer.
private void addWebViewToContainer(WebViewBase webViewBase) {
PrebidWebViewBase defaultContainer = (PrebidWebViewBase) webViewBase.getPreloadedListener();
if (defaultContainer != null) {
defaultContainer.addView(webViewBase, 0);
defaultContainer.setVisibility(View.VISIBLE);
}
}
use of org.prebid.mobile.rendering.views.webview.PrebidWebViewBase in project prebid-mobile-android by prebid.
the class HTMLCreativeTest method prebidWebViewDelegateEventTest.
@Test
public void prebidWebViewDelegateEventTest() throws Exception {
// External link
PrebidWebViewBase mockPrebidWebViewBase = mock(PrebidWebViewBase.class);
Mockito.doNothing().when(mockPrebidWebViewBase).handleOpen(anyString());
when(mockPrebidWebViewBase.post(any(Runnable.class))).thenReturn(anyBoolean());
mHtmlCreative.setCreativeView(mockPrebidWebViewBase);
mHtmlCreative.webViewShouldOpenExternalLink("foo");
verify(mockPrebidWebViewBase).handleOpen(anyString());
// MRAID link
CreativeViewListener mockCreativeViewListener = mock(CreativeViewListener.class);
mHtmlCreative.setCreativeViewListener(mockCreativeViewListener);
mHtmlCreative.webViewShouldOpenMRAIDLink("foo");
verify(mockCreativeViewListener).creativeWasClicked(any(HTMLCreative.class), anyString());
verify(mockPrebidWebViewBase).post(any(Runnable.class));
}
use of org.prebid.mobile.rendering.views.webview.PrebidWebViewBase in project prebid-mobile-android by prebid.
the class HTMLCreativeTest method displayTest.
@Test
public void displayTest() throws Exception {
// Null view
PrebidWebViewBase prebidWebViewBase = new PrebidWebViewBase(mContext, mMockInterstitialManager);
WhiteBox.setInternalState(prebidWebViewBase, "mWebView", mock(WebViewBase.class));
when(mMockPrebidWebView.getWebView()).thenReturn(mock(WebViewBase.class));
when(mMockConfig.getAdUnitIdentifierType()).thenReturn(AdConfiguration.AdUnitIdentifierType.BANNER);
mHtmlCreative.display();
verify(mMockModel, never()).trackDisplayAdEvent(TrackingEvent.Events.IMPRESSION);
}
use of org.prebid.mobile.rendering.views.webview.PrebidWebViewBase in project prebid-mobile-android by prebid.
the class HTMLCreativeTest method viewabilityTrackListenerExecutionIsViewable_trackImpression.
@Test
public void viewabilityTrackListenerExecutionIsViewable_trackImpression() {
ViewExposure viewExposure = new ViewExposure();
PrebidWebViewBase mockPrebidWebViewBase = mock(PrebidWebViewBase.class);
when(mockPrebidWebViewBase.getWebView()).thenReturn(mock(WebViewBase.class));
mHtmlCreative.setCreativeView(mockPrebidWebViewBase);
VisibilityTrackerResult result = new VisibilityTrackerResult(NativeEventTracker.EventType.IMPRESSION, viewExposure, true, true);
mHtmlCreative.onVisibilityEvent(result);
verify(mMockModel, times(1)).trackDisplayAdEvent(TrackingEvent.Events.IMPRESSION);
verify(mockPrebidWebViewBase, times(1)).onWindowFocusChanged(true);
verify(mockPrebidWebViewBase, times(1)).onViewExposureChange(viewExposure);
}
use of org.prebid.mobile.rendering.views.webview.PrebidWebViewBase in project prebid-mobile-android by prebid.
the class MraidController method displaPrebidWebViewForMraid.
private void displaPrebidWebViewForMraid(final WebViewBase adBaseView, final boolean isNewlyLoaded, MraidEvent mraidEvent) {
displayMraidInInterstitial(adBaseView, false, mraidEvent, () -> {
if (isNewlyLoaded) {
// handle 2 part expand
PrebidWebViewBase oxWebview = (PrebidWebViewBase) adBaseView.getPreloadedListener();
oxWebview.initMraidExpanded();
}
});
}
Aggregations