Search in sources :

Example 51 with AdConfiguration

use of org.prebid.mobile.rendering.models.AdConfiguration 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 52 with AdConfiguration

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

the class DisplayViewTest method setup.

@Before
public void setup() throws Exception {
    MockitoAnnotations.initMocks(DisplayViewTest.this);
    mContext = Robolectric.buildActivity(Activity.class).create().get();
    mAdUnitConfiguration = new AdConfiguration();
    mAdUnitConfiguration.setAdUnitIdentifierType(AdConfiguration.AdUnitIdentifierType.BANNER);
    BidResponse mockResponse = mock(BidResponse.class);
    Bid mockBid = mock(Bid.class);
    when(mockBid.getAdm()).thenReturn("adm");
    when(mockResponse.getWinningBid()).thenReturn(mockBid);
    mDisplayView = new DisplayView(mContext, mMockDisplayViewListener, mAdUnitConfiguration, mockResponse);
    reset(mMockDisplayViewListener);
}
Also used : AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) Activity(android.app.Activity) BidResponse(org.prebid.mobile.rendering.bidding.data.bid.BidResponse) Bid(org.prebid.mobile.rendering.bidding.data.bid.Bid) Before(org.junit.Before)

Example 53 with AdConfiguration

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

the class InterstitialControllerTest method loadAd_ExecuteInterstitialViewLoadAd.

@Test
public void loadAd_ExecuteInterstitialViewLoadAd() {
    final AdConfiguration mockAdUnitConfiguration = mock(AdConfiguration.class);
    final BidResponse mockBidResponse = mock(BidResponse.class);
    mInterstitialController.loadAd(mockAdUnitConfiguration, mockBidResponse);
    verify(mMockInterstitialView, times(1)).loadAd(eq(mockAdUnitConfiguration), eq(mockBidResponse));
}
Also used : AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) BidResponse(org.prebid.mobile.rendering.bidding.data.bid.BidResponse) Test(org.junit.Test)

Example 54 with AdConfiguration

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

the class MediationBannerAdUnitTest method whenInitAdConfig_PrepareAdConfigForBanner.

@Test
public void whenInitAdConfig_PrepareAdConfigForBanner() {
    AdSize adSize = new AdSize(1, 2);
    mMediationBannerAdUnit.initAdConfig("config", adSize);
    AdConfiguration adConfiguration = mMediationBannerAdUnit.mAdUnitConfig;
    assertEquals("config", adConfiguration.getConfigId());
    assertEquals(AdConfiguration.AdUnitIdentifierType.BANNER, adConfiguration.getAdUnitIdentifierType());
    assertTrue(adConfiguration.getAdSizes().contains(adSize));
}
Also used : AdSize(org.prebid.mobile.rendering.bidding.data.AdSize) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) Test(org.junit.Test)

Example 55 with AdConfiguration

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

the class MediationRewardedVideoAdUnitTest method whenInitAdConfig_PrepareAdConfigForInterstitial.

@Test
public void whenInitAdConfig_PrepareAdConfigForInterstitial() {
    mMopubRewardedAdUnit.initAdConfig("config", null);
    AdConfiguration adConfiguration = mMopubRewardedAdUnit.mAdUnitConfig;
    assertEquals("config", adConfiguration.getConfigId());
    assertEquals(AdConfiguration.AdUnitIdentifierType.VAST, adConfiguration.getAdUnitIdentifierType());
    assertTrue(adConfiguration.isRewarded());
}
Also used : AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) Test(org.junit.Test)

Aggregations

AdConfiguration (org.prebid.mobile.rendering.models.AdConfiguration)57 Test (org.junit.Test)38 BasicParameterBuilder (org.prebid.mobile.rendering.networking.parameters.BasicParameterBuilder)15 AdSize (org.prebid.mobile.rendering.bidding.data.AdSize)13 BidRequest (org.prebid.mobile.rendering.models.openrtb.BidRequest)11 Before (org.junit.Before)8 Imp (org.prebid.mobile.rendering.models.openrtb.bidRequests.Imp)8 Context (android.content.Context)6 JSONObject (org.json.JSONObject)6 BidResponse (org.prebid.mobile.rendering.bidding.data.bid.BidResponse)6 Activity (android.app.Activity)5 AdException (org.prebid.mobile.rendering.errors.AdException)5 AbstractCreative (org.prebid.mobile.rendering.models.AbstractCreative)5 VideoCreativeModel (org.prebid.mobile.rendering.video.VideoCreativeModel)5 AdViewManager (org.prebid.mobile.rendering.views.AdViewManager)5 Handler (android.os.Handler)3 JSONArray (org.json.JSONArray)3 HTMLCreative (org.prebid.mobile.rendering.models.HTMLCreative)3 Ext (org.prebid.mobile.rendering.models.openrtb.bidRequests.Ext)3 User (org.prebid.mobile.rendering.models.openrtb.bidRequests.User)3