use of org.prebid.mobile.rendering.models.AdConfiguration in project prebid-mobile-android by prebid.
the class PrebidWebViewBannerTest method loadHTMLTest.
@Test
public void loadHTMLTest() throws IOException {
HTMLCreative mockCreative = mock(HTMLCreative.class);
CreativeModel mockCreativeModel = mock(CreativeModel.class);
when(mockCreative.getCreativeModel()).thenReturn(mockCreativeModel);
when(mockCreativeModel.getHtml()).thenReturn(ResourceUtils.convertResourceToString("ad_contains_iframe"));
when(mockCreativeModel.getAdConfiguration()).thenReturn(new AdConfiguration());
mBanner.mCreative = mockCreative;
mBanner.loadHTML(mAdHTML, 100, 200);
assertNotNull(mBanner.mWebView);
assertEquals("1part", mBanner.mWebView.mMRAIDBridgeName);
}
use of org.prebid.mobile.rendering.models.AdConfiguration in project prebid-mobile-android by prebid.
the class AdViewManagerTest method creativeDidCompleteTest.
@Test
public void creativeDidCompleteTest() throws Exception {
VideoCreative mockVideoCreative = mock(VideoCreative.class);
when(mockVideoCreative.getCreativeModel()).thenReturn(new VideoCreativeModel(mock(TrackingManager.class), mock(OmEventTracker.class), new AdConfiguration()));
when(mockVideoCreative.isVideo()).thenReturn(true);
Transaction mockTransaction = mock(Transaction.class);
ArrayList<CreativeFactory> creativeFactories = new ArrayList<>();
TransactionManager mockTransactionManager = mock(TransactionManager.class);
when(mockTransactionManager.getCurrentTransaction()).thenReturn(mockTransaction);
when(mockTransaction.getCreativeFactories()).thenReturn(creativeFactories);
WhiteBox.field(AdViewManager.class, "mTransactionManager").set(mAdViewManager, mockTransactionManager);
WhiteBox.field(AdViewManager.class, "mAdView").set(mAdViewManager, mockAdView);
mAdViewManager.creativeDidComplete(mockVideoCreative);
verify(mockAdView).closeInterstitialVideo();
verify(mMockAdViewListener, times(1)).adCompleted();
mAdViewManager.creativeDidComplete(mockVideoCreative);
verify(mMockAdViewListener, times(2)).adCompleted();
}
use of org.prebid.mobile.rendering.models.AdConfiguration in project prebid-mobile-android by prebid.
the class VideoCreativeTest method loadTest.
@Test
public void loadTest() throws Exception {
VideoCreativeModel mockModel = mock(VideoCreativeModel.class);
when(mockModel.getMediaUrl()).thenReturn("/video.mp4");
AdConfiguration mockAdConfig = mock(AdConfiguration.class);
when(mockModel.getAdConfiguration()).thenReturn(mockAdConfig);
WhiteBox.field(VideoCreative.class, "mModel").set(mVideoCreative, mockModel);
mVideoCreative.load();
assertNotNull(WhiteBox.getInternalState(mVideoCreative, "mVideoDownloadTask"));
}
use of org.prebid.mobile.rendering.models.AdConfiguration in project prebid-mobile-android by prebid.
the class BaseAdViewTest method setUp.
@Before
public void setUp() throws Exception {
mMockContext = spy(Robolectric.buildActivity(Activity.class).create().get());
mBaseAdView = new BaseAdView(mMockContext) {
@Override
protected void notifyErrorListeners(AdException adException) {
}
};
mMockAdViewManager = Mockito.mock(AdViewManager.class);
when(mMockAdViewManager.getAdConfiguration()).thenReturn(new AdConfiguration());
Field field = WhiteBox.field(BaseAdView.class, "mAdViewManager");
field.set(mBaseAdView, mMockAdViewManager);
}
use of org.prebid.mobile.rendering.models.AdConfiguration 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);
}
Aggregations