Search in sources :

Example 16 with AbstractCreative

use of org.prebid.mobile.rendering.models.AbstractCreative in project prebid-mobile-android by prebid.

the class AdViewManagerTest method hideTest.

@Test
public void hideTest() throws IllegalAccessException {
    AbstractCreative mockCreative = mock(AbstractCreative.class);
    mAdViewManager.hide();
    verify(mockAdView, never()).removeView(any(View.class));
    WhiteBox.field(AdViewManager.class, "mCurrentCreative").set(mAdViewManager, mockCreative);
    mAdViewManager.hide();
    verify(mockAdView).removeView(any());
}
Also used : AbstractCreative(org.prebid.mobile.rendering.models.AbstractCreative) InterstitialView(org.prebid.mobile.rendering.bidding.display.InterstitialView) View(android.view.View) VideoCreativeView(org.prebid.mobile.rendering.video.VideoCreativeView) VideoView(org.prebid.mobile.rendering.bidding.display.VideoView) Test(org.junit.Test)

Example 17 with AbstractCreative

use of org.prebid.mobile.rendering.models.AbstractCreative in project prebid-mobile-android by prebid.

the class CreativeFactoryTest method testAttemptAuidCreative.

@Test
public void testAttemptAuidCreative() throws Exception {
    AdConfiguration adConfiguration = new AdConfiguration();
    adConfiguration.setAdUnitIdentifierType(AdConfiguration.AdUnitIdentifierType.BANNER);
    Handler mockHandler = mock(Handler.class);
    when(mMockModel.getAdConfiguration()).thenReturn(adConfiguration);
    when(mMockModel.getName()).thenReturn(HTML_CREATIVE_TAG);
    when(mMockModel.getImpressionUrl()).thenReturn("impressionUrl");
    when(mMockModel.getClickUrl()).thenReturn("clickUrl");
    // Run the creativeFactory
    CreativeFactory creativeFactory = new CreativeFactory(mMockContext, mMockModel, mMockListener, mMockOmAdSessionManager, mMockInterstitialManager);
    WhiteBox.field(CreativeFactory.class, "mTimeoutHandler").set(creativeFactory, mockHandler);
    creativeFactory.start();
    AbstractCreative creative = creativeFactory.getCreative();
    assertNotNull(creative);
    assertTrue(creative instanceof HTMLCreative);
    verify(mockHandler).postDelayed(any(Runnable.class), eq(6_000L));
}
Also used : AbstractCreative(org.prebid.mobile.rendering.models.AbstractCreative) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) Handler(android.os.Handler) HTMLCreative(org.prebid.mobile.rendering.models.HTMLCreative) Test(org.junit.Test)

Example 18 with AbstractCreative

use of org.prebid.mobile.rendering.models.AbstractCreative in project prebid-mobile-android by prebid.

the class AdViewManager method show.

public void show() {
    if (!isCreativeResolved()) {
        LogUtil.debug(TAG, "Couldn't proceed show(): Video or HTML is not resolved.");
        return;
    }
    AbstractCreative creative = mTransactionManager.getCurrentCreative();
    if (creative == null) {
        LogUtil.error(TAG, "Show called with no ad");
        return;
    }
    // Display current creative
    mCurrentCreative = creative;
    mCurrentCreative.setCreativeViewListener(this);
    handleCreativeDisplay();
}
Also used : AbstractCreative(org.prebid.mobile.rendering.models.AbstractCreative)

Aggregations

AbstractCreative (org.prebid.mobile.rendering.models.AbstractCreative)18 Test (org.junit.Test)17 View (android.view.View)6 InterstitialView (org.prebid.mobile.rendering.bidding.display.InterstitialView)6 VideoView (org.prebid.mobile.rendering.bidding.display.VideoView)6 TransactionManager (org.prebid.mobile.rendering.loading.TransactionManager)6 VideoCreativeView (org.prebid.mobile.rendering.video.VideoCreativeView)6 AdConfiguration (org.prebid.mobile.rendering.models.AdConfiguration)5 ArgumentCaptor (org.mockito.ArgumentCaptor)4 VideoCreativeModel (org.prebid.mobile.rendering.video.VideoCreativeModel)4 Context (android.content.Context)3 AdViewManager (org.prebid.mobile.rendering.views.AdViewManager)3 AdViewManagerListener (org.prebid.mobile.rendering.views.AdViewManagerListener)3 Handler (android.os.Handler)2 ArrayList (java.util.ArrayList)2 Transaction (org.prebid.mobile.rendering.loading.Transaction)2 ViewGroup (android.view.ViewGroup)1 HashMap (java.util.HashMap)1 CreativeFactory (org.prebid.mobile.rendering.loading.CreativeFactory)1 AdDetails (org.prebid.mobile.rendering.models.AdDetails)1