Search in sources :

Example 16 with PrebidWebViewBase

use of org.prebid.mobile.rendering.views.webview.PrebidWebViewBase in project prebid-mobile-android by prebid.

the class HTMLCreativeTest method adSessionSuccessInitializationTest.

@Test
public void adSessionSuccessInitializationTest() throws Exception {
    PrebidWebViewBase prebidWebView = new PrebidWebViewBase(mContext, mMockInterstitialManager);
    WebViewBase mockWebViewBase = mock(WebViewBase.class);
    BaseJSInterface baseJSInterface = mock(BaseJSInterface.class);
    when(mockWebViewBase.getMRAIDInterface()).thenReturn(baseJSInterface);
    WhiteBox.setInternalState(prebidWebView, "mWebView", mockWebViewBase);
    mHtmlCreative.setCreativeView(prebidWebView);
    mHtmlCreative.setCreativeView(prebidWebView);
    HTMLCreative spyHtmlCreative = spy(mHtmlCreative);
    spyHtmlCreative.display();
}
Also used : BaseJSInterface(org.prebid.mobile.rendering.views.webview.mraid.BaseJSInterface) 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 17 with PrebidWebViewBase

use of org.prebid.mobile.rendering.views.webview.PrebidWebViewBase in project prebid-mobile-android by prebid.

the class HTMLCreativeTest method createOmAdSessionTest.

@Test
public void createOmAdSessionTest() throws IllegalAccessException {
    PrebidWebViewBase mockWebView = mock(PrebidWebViewBase.class);
    when(mockWebView.getWebView()).thenReturn(mock(WebViewBase.class));
    mHtmlCreative.setCreativeView(mockWebView);
    mHtmlCreative.createOmAdSession();
    verify(mMockOmAdSessionManager).initWebAdSessionManager(any(WebViewBase.class), any());
    verify(mMockOmAdSessionManager).registerAdView(any(View.class));
    verify(mMockOmAdSessionManager).startAdSession();
    reset(mMockOmAdSessionManager);
    mHtmlCreative.mWeakOmAdSessionManager = new WeakReference<>(null);
    mHtmlCreative.createOmAdSession();
    verify(mMockOmAdSessionManager, never()).startAdSession();
    mHtmlCreative.setCreativeView(null);
    mHtmlCreative.createOmAdSession();
    verify(mMockOmAdSessionManager, never()).startAdSession();
}
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) View(android.view.View) Test(org.junit.Test)

Example 18 with PrebidWebViewBase

use of org.prebid.mobile.rendering.views.webview.PrebidWebViewBase in project prebid-mobile-android by prebid.

the class HTMLCreativeViewTest method testSetMediaUrl.

@Test
public void testSetMediaUrl() throws Exception {
    PrebidWebViewBase mockHTMLCreativeView = new PrebidWebViewBase(mMockContext, mock(InterstitialManager.class));
    // mockHTMLCreativeView.start();
    assertNotNull(mockHTMLCreativeView);
}
Also used : PrebidWebViewBase(org.prebid.mobile.rendering.views.webview.PrebidWebViewBase) InterstitialManager(org.prebid.mobile.rendering.views.interstitial.InterstitialManager) Test(org.junit.Test)

Example 19 with PrebidWebViewBase

use of org.prebid.mobile.rendering.views.webview.PrebidWebViewBase in project prebid-mobile-android by prebid.

the class BaseJSInterface method notifyMraidEventHandler.

private void notifyMraidEventHandler() {
    mOrientationBroadcastReceiver.setMraidAction(mMraidEvent.mraidAction);
    HTMLCreative htmlCreative = ((PrebidWebViewBase) mAdBaseView.getPreloadedListener()).getCreative();
    mAdBaseView.post(new MraidEventHandlerNotifierRunnable(htmlCreative, mAdBaseView, mMraidEvent, mJsExecutor));
}
Also used : PrebidWebViewBase(org.prebid.mobile.rendering.views.webview.PrebidWebViewBase) MraidEventHandlerNotifierRunnable(org.prebid.mobile.rendering.mraid.methods.MraidEventHandlerNotifierRunnable) HTMLCreative(org.prebid.mobile.rendering.models.HTMLCreative)

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