Search in sources :

Example 1 with AdViewManager

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

the class InterstitialVideoTest method whenRemainingTimePresent_UseRemainingTime.

@Test
public void whenRemainingTimePresent_UseRemainingTime() throws Exception {
    Context context = mock(Context.class);
    AdViewManager adViewManager = new AdViewManager(context, mock(AdViewManagerListener.class), mMockAdView, mock(InterstitialManager.class));
    AdConfiguration adConfiguration = adViewManager.getAdConfiguration();
    adConfiguration.setVideoSkipOffset(10);
    AbstractCreative mockCreative = mock(AbstractCreative.class);
    VideoCreativeModel mockModel = mock(VideoCreativeModel.class);
    when(mockModel.getSkipOffset()).thenReturn(20L);
    when(mockCreative.getCreativeModel()).thenReturn(mockModel);
    WhiteBox.field(AdViewManager.class, "mCurrentCreative").set(adViewManager, mockCreative);
    when(mMockAdView.getMediaOffset()).thenReturn(adViewManager.getSkipOffset());
    mSpyInterstitialVideo.setRemainingTimeInMs(3000);
    mSpyInterstitialVideo.scheduleShowCloseBtnTask(mMockAdView, 3000);
    verify(mSpyInterstitialVideo).scheduleTimer(3L * 1000);
}
Also used : Context(android.content.Context) AbstractCreative(org.prebid.mobile.rendering.models.AbstractCreative) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) AdViewManager(org.prebid.mobile.rendering.views.AdViewManager) AdViewManagerListener(org.prebid.mobile.rendering.views.AdViewManagerListener) VideoCreativeModel(org.prebid.mobile.rendering.video.VideoCreativeModel) Test(org.junit.Test)

Example 2 with AdViewManager

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

the class InterstitialVideoTest method whenAllOffsetsPresent_UseSscOffset.

@Test
public void whenAllOffsetsPresent_UseSscOffset() throws Exception {
    Context context = mock(Context.class);
    AdViewManager adViewManager = new AdViewManager(context, mock(AdViewManagerListener.class), mMockAdView, mMockInterstitialManager);
    AdConfiguration adConfiguration = adViewManager.getAdConfiguration();
    adConfiguration.setVideoSkipOffset(10000);
    AbstractCreative mockCreative = mock(AbstractCreative.class);
    VideoCreativeModel mockModel = mock(VideoCreativeModel.class);
    when(mockModel.getSkipOffset()).thenReturn(20000L);
    when(mockCreative.getCreativeModel()).thenReturn(mockModel);
    WhiteBox.field(AdViewManager.class, "mCurrentCreative").set(adViewManager, mockCreative);
    when(mMockAdView.getMediaOffset()).thenReturn(adViewManager.getSkipOffset());
    mSpyInterstitialVideo.scheduleShowCloseBtnTask(mMockAdView);
    verify(mSpyInterstitialVideo).scheduleTimer(10L * 1000);
}
Also used : Context(android.content.Context) AbstractCreative(org.prebid.mobile.rendering.models.AbstractCreative) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) AdViewManager(org.prebid.mobile.rendering.views.AdViewManager) AdViewManagerListener(org.prebid.mobile.rendering.views.AdViewManagerListener) VideoCreativeModel(org.prebid.mobile.rendering.video.VideoCreativeModel) Test(org.junit.Test)

Example 3 with AdViewManager

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

the class DisplayView method displayHtmlAd.

private void displayHtmlAd(BidResponse response) throws AdException {
    mAdViewManager = new AdViewManager(getContext(), mAdViewManagerListener, this, mInterstitialManager);
    mAdViewManager.loadBidTransaction(mAdUnitConfiguration, response);
    mEventForwardingReceiver = new EventForwardingLocalBroadcastReceiver(mAdUnitConfiguration.getBroadcastId(), mBroadcastListener);
    mEventForwardingReceiver.register(getContext(), mEventForwardingReceiver);
}
Also used : EventForwardingLocalBroadcastReceiver(org.prebid.mobile.rendering.utils.broadcast.local.EventForwardingLocalBroadcastReceiver) AdViewManager(org.prebid.mobile.rendering.views.AdViewManager)

Example 4 with AdViewManager

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

the class InterstitialView method setAdViewManagerValues.

protected void setAdViewManagerValues() throws AdException {
    mAdViewManager = new AdViewManager(getContext(), mOnAdViewManagerListener, this, mInterstitialManager);
    AdConfiguration adConfiguration = mAdViewManager.getAdConfiguration();
    adConfiguration.setAutoRefreshDelay(0);
}
Also used : AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) AdViewManager(org.prebid.mobile.rendering.views.AdViewManager)

Example 5 with AdViewManager

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

the class InterstitialVideoTest method whenVastAndSscOffsetPresent_UseSscOffset.

@Test
public void whenVastAndSscOffsetPresent_UseSscOffset() throws Exception {
    Context context = mock(Context.class);
    AdViewManager adViewManager = new AdViewManager(context, mock(AdViewManagerListener.class), mMockAdView, mMockInterstitialManager);
    AdConfiguration adConfiguration = adViewManager.getAdConfiguration();
    adConfiguration.setVideoSkipOffset(10000);
    AbstractCreative mockCreative = mock(AbstractCreative.class);
    VideoCreativeModel mockModel = mock(VideoCreativeModel.class);
    when(mockModel.getSkipOffset()).thenReturn(20000L);
    when(mockCreative.getCreativeModel()).thenReturn(mockModel);
    WhiteBox.field(AdViewManager.class, "mCurrentCreative").set(adViewManager, mockCreative);
    when(mMockAdView.getMediaOffset()).thenReturn(adViewManager.getSkipOffset());
    mSpyInterstitialVideo.scheduleShowCloseBtnTask(mMockAdView);
    verify(mSpyInterstitialVideo).scheduleTimer(10L * 1000);
}
Also used : Context(android.content.Context) AbstractCreative(org.prebid.mobile.rendering.models.AbstractCreative) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) AdViewManager(org.prebid.mobile.rendering.views.AdViewManager) AdViewManagerListener(org.prebid.mobile.rendering.views.AdViewManagerListener) VideoCreativeModel(org.prebid.mobile.rendering.video.VideoCreativeModel) Test(org.junit.Test)

Aggregations

AdViewManager (org.prebid.mobile.rendering.views.AdViewManager)5 AdConfiguration (org.prebid.mobile.rendering.models.AdConfiguration)4 Context (android.content.Context)3 Test (org.junit.Test)3 AbstractCreative (org.prebid.mobile.rendering.models.AbstractCreative)3 VideoCreativeModel (org.prebid.mobile.rendering.video.VideoCreativeModel)3 AdViewManagerListener (org.prebid.mobile.rendering.views.AdViewManagerListener)3 EventForwardingLocalBroadcastReceiver (org.prebid.mobile.rendering.utils.broadcast.local.EventForwardingLocalBroadcastReceiver)1