Search in sources :

Example 1 with VideoCreativeViewListener

use of org.prebid.mobile.rendering.listeners.VideoCreativeViewListener in project prebid-mobile-android by prebid.

the class ViewPoolTest method getUnoccupiedViewTest.

@Test
public void getUnoccupiedViewTest() throws AdException {
    VideoCreativeViewListener mockVideoCreativeViewListener = mock(VideoCreativeViewListener.class);
    AdConfiguration.AdUnitIdentifierType adType = AdConfiguration.AdUnitIdentifierType.BANNER;
    InterstitialManager mockInterstitialManager = mock(InterstitialManager.class);
    View result = mViewPool.getUnoccupiedView(mContext, mockVideoCreativeViewListener, adType, mockInterstitialManager);
    assertEquals(mUnoccupiedView, result);
    assertEquals(2, mViewPool.sizeOfOccupied());
    assertEquals(0, mViewPool.sizeOfUnoccupied());
    result = mViewPool.getUnoccupiedView(mContext, mockVideoCreativeViewListener, adType, mockInterstitialManager);
    assertThat(result, instanceOf(PrebidWebViewBanner.class));
    assertEquals(3, mViewPool.sizeOfOccupied());
    assertEquals(0, mViewPool.sizeOfUnoccupied());
    adType = AdConfiguration.AdUnitIdentifierType.VAST;
    result = mViewPool.getUnoccupiedView(mContext, mock(VideoCreative.class), adType, mockInterstitialManager);
    assertThat(result, instanceOf(ExoPlayerView.class));
    assertEquals(4, mViewPool.sizeOfOccupied());
    assertEquals(0, mViewPool.sizeOfUnoccupied());
    adType = AdConfiguration.AdUnitIdentifierType.INTERSTITIAL;
    result = mViewPool.getUnoccupiedView(mContext, mockVideoCreativeViewListener, adType, mockInterstitialManager);
    assertThat(result, instanceOf(PrebidWebViewInterstitial.class));
    assertEquals(5, mViewPool.sizeOfOccupied());
    assertEquals(0, mViewPool.sizeOfUnoccupied());
}
Also used : PrebidWebViewInterstitial(org.prebid.mobile.rendering.views.webview.PrebidWebViewInterstitial) VideoCreativeViewListener(org.prebid.mobile.rendering.listeners.VideoCreativeViewListener) InterstitialManager(org.prebid.mobile.rendering.views.interstitial.InterstitialManager) PrebidWebViewBanner(org.prebid.mobile.rendering.views.webview.PrebidWebViewBanner) ExoPlayerView(org.prebid.mobile.rendering.video.ExoPlayerView) ExoPlayerView(org.prebid.mobile.rendering.video.ExoPlayerView) View(android.view.View) Test(org.junit.Test)

Aggregations

View (android.view.View)1 Test (org.junit.Test)1 VideoCreativeViewListener (org.prebid.mobile.rendering.listeners.VideoCreativeViewListener)1 ExoPlayerView (org.prebid.mobile.rendering.video.ExoPlayerView)1 InterstitialManager (org.prebid.mobile.rendering.views.interstitial.InterstitialManager)1 PrebidWebViewBanner (org.prebid.mobile.rendering.views.webview.PrebidWebViewBanner)1 PrebidWebViewInterstitial (org.prebid.mobile.rendering.views.webview.PrebidWebViewInterstitial)1