Search in sources :

Example 1 with InterstitialView

use of org.prebid.mobile.rendering.bidding.display.InterstitialView in project prebid-mobile-android by prebid.

the class AdViewManagerTest method testAdViewManager.

@Test
public void testAdViewManager() throws Exception {
    AdViewManagerListener mockAdViewListener = mock(AdViewManagerListener.class);
    InterstitialView mockAdView = mock(InterstitialView.class);
    AdViewManager adViewManager = new AdViewManager(mContext, mockAdViewListener, mockAdView, mMockInterstitialManager);
    assertNotNull(adViewManager);
}
Also used : InterstitialView(org.prebid.mobile.rendering.bidding.display.InterstitialView) Test(org.junit.Test)

Example 2 with InterstitialView

use of org.prebid.mobile.rendering.bidding.display.InterstitialView in project prebid-mobile-android by prebid.

the class AdViewManagerTest method testAdViewManagerNullParams.

@Test
public void testAdViewManagerNullParams() {
    InterstitialView mockAdView = mock(InterstitialView.class);
    AdViewManager adViewManager = null;
    AdException err = null;
    try {
        adViewManager = new AdViewManager(mContext, null, mockAdView, mMockInterstitialManager);
    } catch (Exception e) {
        err = new AdException(AdException.INTERNAL_ERROR, e.getMessage());
    }
    assertNotNull(err);
    assertNull(adViewManager);
}
Also used : InterstitialView(org.prebid.mobile.rendering.bidding.display.InterstitialView) AdException(org.prebid.mobile.rendering.errors.AdException) AdException(org.prebid.mobile.rendering.errors.AdException) Test(org.junit.Test)

Example 3 with InterstitialView

use of org.prebid.mobile.rendering.bidding.display.InterstitialView in project prebid-mobile-android by prebid.

the class InterstitialManagerTest method displayViewAsInterstitialSuccess_ShowInterstitialAdView.

@Test
@LooperMode(LooperMode.Mode.PAUSED)
public void displayViewAsInterstitialSuccess_ShowInterstitialAdView() {
    VideoCreative mockVideoCreative = mock(VideoCreative.class);
    when(mockVideoCreative.isResolved()).thenReturn(true);
    BaseJSInterface mockJsInterface = mock(BaseJSInterface.class);
    when(mockJsInterface.getJsExecutor()).thenReturn(mock(JsExecutor.class));
    WebViewBase mockWebViewBase = mock(WebViewBase.class);
    when(mockWebViewBase.getMRAIDInterface()).thenReturn(mockJsInterface);
    PrebidWebViewInterstitial mockPrebidWebViewInterstitial = mock(PrebidWebViewInterstitial.class);
    when(mockPrebidWebViewInterstitial.getWebView()).thenReturn(mockWebViewBase);
    InterstitialView mockInterstitialView = mock(InterstitialView.class);
    when(mockInterstitialView.getCreativeView()).thenReturn(mockPrebidWebViewInterstitial);
    mSpyInterstitialManager.displayAdViewInInterstitial(mContext, mockInterstitialView);
    verify(mMockAdViewDelegate).showInterstitial();
}
Also used : BaseJSInterface(org.prebid.mobile.rendering.views.webview.mraid.BaseJSInterface) PrebidWebViewInterstitial(org.prebid.mobile.rendering.views.webview.PrebidWebViewInterstitial) VideoCreative(org.prebid.mobile.rendering.video.VideoCreative) JsExecutor(org.prebid.mobile.rendering.views.webview.mraid.JsExecutor) WebViewBase(org.prebid.mobile.rendering.views.webview.WebViewBase) InterstitialView(org.prebid.mobile.rendering.bidding.display.InterstitialView) Test(org.junit.Test) LooperMode(org.robolectric.annotation.LooperMode)

Example 4 with InterstitialView

use of org.prebid.mobile.rendering.bidding.display.InterstitialView in project prebid-mobile-android by prebid.

the class AdViewManagerTest method testAdViewManagerNullAdViewListener.

@Test
public void testAdViewManagerNullAdViewListener() {
    InterstitialView mockAdView = mock(InterstitialView.class);
    AdViewManager adViewManager = null;
    AdException err = null;
    try {
        adViewManager = new AdViewManager(mContext, null, mockAdView, mMockInterstitialManager);
    } catch (AdException e) {
        err = e;
    }
    assertNotNull(err);
    assertNull(adViewManager);
    assertEquals(AdException.INTERNAL_ERROR + ": AdViewManagerListener is null", err.getMessage());
}
Also used : InterstitialView(org.prebid.mobile.rendering.bidding.display.InterstitialView) AdException(org.prebid.mobile.rendering.errors.AdException) Test(org.junit.Test)

Example 5 with InterstitialView

use of org.prebid.mobile.rendering.bidding.display.InterstitialView in project prebid-mobile-android by prebid.

the class InterstitialManager method displayAdViewInInterstitial.

// Note: The context should be the Activity this view will display on top of
public void displayAdViewInInterstitial(Context context, View view) {
    if (!(context instanceof Activity)) {
        LogUtil.error(TAG, "displayAdViewInInterstitial(): Can not display interstitial without activity context");
        return;
    }
    if (view instanceof InterstitialView) {
        // TODO: 13.08.2020 Remove casts to specific view
        InterstitialView interstitialView = ((InterstitialView) view);
        show();
        showInterstitialDialog(context, interstitialView);
    }
}
Also used : Activity(android.app.Activity) InterstitialView(org.prebid.mobile.rendering.bidding.display.InterstitialView)

Aggregations

InterstitialView (org.prebid.mobile.rendering.bidding.display.InterstitialView)5 Test (org.junit.Test)4 AdException (org.prebid.mobile.rendering.errors.AdException)2 Activity (android.app.Activity)1 VideoCreative (org.prebid.mobile.rendering.video.VideoCreative)1 PrebidWebViewInterstitial (org.prebid.mobile.rendering.views.webview.PrebidWebViewInterstitial)1 WebViewBase (org.prebid.mobile.rendering.views.webview.WebViewBase)1 BaseJSInterface (org.prebid.mobile.rendering.views.webview.mraid.BaseJSInterface)1 JsExecutor (org.prebid.mobile.rendering.views.webview.mraid.JsExecutor)1 LooperMode (org.robolectric.annotation.LooperMode)1