Search in sources :

Example 6 with PrebidWebViewBase

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);
    }
}
Also used : PrebidWebViewBase(org.prebid.mobile.rendering.views.webview.PrebidWebViewBase)

Example 7 with PrebidWebViewBase

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));
}
Also used : PrebidWebViewBase(org.prebid.mobile.rendering.views.webview.PrebidWebViewBase) CreativeViewListener(org.prebid.mobile.rendering.listeners.CreativeViewListener) Test(org.junit.Test)

Example 8 with PrebidWebViewBase

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);
}
Also used : PrebidWebViewBase(org.prebid.mobile.rendering.views.webview.PrebidWebViewBase) WebViewBase(org.prebid.mobile.rendering.views.webview.WebViewBase) PrebidWebViewBase(org.prebid.mobile.rendering.views.webview.PrebidWebViewBase) Test(org.junit.Test)

Example 9 with PrebidWebViewBase

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);
}
Also used : PrebidWebViewBase(org.prebid.mobile.rendering.views.webview.PrebidWebViewBase) WebViewBase(org.prebid.mobile.rendering.views.webview.WebViewBase) PrebidWebViewBase(org.prebid.mobile.rendering.views.webview.PrebidWebViewBase) VisibilityTrackerResult(org.prebid.mobile.rendering.models.internal.VisibilityTrackerResult) ViewExposure(org.prebid.mobile.rendering.utils.exposure.ViewExposure) Test(org.junit.Test)

Example 10 with PrebidWebViewBase

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();
        }
    });
}
Also used : PrebidWebViewBase(org.prebid.mobile.rendering.views.webview.PrebidWebViewBase)

Aggregations

PrebidWebViewBase (org.prebid.mobile.rendering.views.webview.PrebidWebViewBase)19 Test (org.junit.Test)12 WebViewBase (org.prebid.mobile.rendering.views.webview.WebViewBase)8 HTMLCreative (org.prebid.mobile.rendering.models.HTMLCreative)3 View (android.view.View)2 MraidEvent (org.prebid.mobile.rendering.models.internal.MraidEvent)2 VisibilityTrackerResult (org.prebid.mobile.rendering.models.internal.VisibilityTrackerResult)2 BaseJSInterface (org.prebid.mobile.rendering.views.webview.mraid.BaseJSInterface)2 Context (android.content.Context)1 Rect (android.graphics.Rect)1 Bundle (android.os.Bundle)1 Handler (android.os.Handler)1 Message (android.os.Message)1 FrameLayout (android.widget.FrameLayout)1 WeakReference (java.lang.ref.WeakReference)1 Field (java.lang.reflect.Field)1 Method (java.lang.reflect.Method)1 Before (org.junit.Before)1 AdException (org.prebid.mobile.rendering.errors.AdException)1 AdBaseDialog (org.prebid.mobile.rendering.interstitial.AdBaseDialog)1