Search in sources :

Example 21 with AdConfiguration

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

the class BidRequesterTest method setUp.

@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    mContext = Robolectric.buildActivity(Activity.class).create().get();
    mAdConfiguration = new AdConfiguration();
    mAdRequestInput = new AdRequestInput();
    ManagersResolver.getInstance().prepare(mContext);
}
Also used : AdRequestInput(org.prebid.mobile.rendering.networking.parameters.AdRequestInput) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) Activity(android.app.Activity) Before(org.junit.Before)

Example 22 with AdConfiguration

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

the class VideoCreative method createCreativeView.

// Helper method to reduce duplicate code in the subclass RewardedVideoCreative
private void createCreativeView() throws AdException {
    Uri videoUri = null;
    final Context context = mContextReference.get();
    if (context != null) {
        final AdConfiguration adConfiguration = mModel.getAdConfiguration();
        mVideoCreativeView = new VideoCreativeView(context, this);
        mVideoCreativeView.setBroadcastId(adConfiguration.getBroadcastId());
        // Get the preloaded video from device file storage
        videoUri = Uri.parse(context.getFilesDir() + (mModel.getMediaUrl()));
    }
    // Show call-to-action overlay right away if click through url is available & end card is not available
    showCallToAction();
    mVideoCreativeView.setCallToActionUrl(mModel.getVastClickthroughUrl());
    mVideoCreativeView.setVastVideoDuration(getMediaDuration());
    mVideoCreativeView.setVideoUri(videoUri);
}
Also used : Context(android.content.Context) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) Uri(android.net.Uri)

Example 23 with AdConfiguration

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

the class MediationInterstitialAdUnitTest method whenInitAdConfig_PrepareAdConfigForInterstitial.

@Test
public void whenInitAdConfig_PrepareAdConfigForInterstitial() {
    AdSize adSize = new AdSize(1, 2);
    mMediationInterstitialAdUnit.initAdConfig("config", adSize);
    AdConfiguration adConfiguration = mMediationInterstitialAdUnit.mAdUnitConfig;
    assertEquals("config", adConfiguration.getConfigId());
    assertEquals(AdConfiguration.AdUnitIdentifierType.INTERSTITIAL, adConfiguration.getAdUnitIdentifierType());
    assertEquals(adSize, adConfiguration.getMinSizePercentage());
}
Also used : AdSize(org.prebid.mobile.rendering.bidding.data.AdSize) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) Test(org.junit.Test)

Example 24 with AdConfiguration

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

the class VideoViewTest method loadAd_LoadBidTransaction.

@Test
public void loadAd_LoadBidTransaction() {
    final AdConfiguration adUnitConfiguration = new AdConfiguration();
    final BidResponse bidResponse = new BidResponse("");
    mVideoView.loadAd(adUnitConfiguration, bidResponse);
    verify(mMockAdViewManager).loadBidTransaction(adUnitConfiguration, bidResponse);
}
Also used : AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) BidResponse(org.prebid.mobile.rendering.bidding.data.bid.BidResponse) Test(org.junit.Test)

Example 25 with AdConfiguration

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

the class BaseInterstitialAdUnitTest method setUp.

@Before
public void setUp() throws Exception {
    Context context = Robolectric.buildActivity(Activity.class).create().get();
    mBaseInterstitialAdUnit = new BaseInterstitialAdUnit(context) {

        @Override
        void requestAdWithBid(@Nullable Bid bid) {
        }

        @Override
        void showGamAd() {
        }

        @Override
        void notifyAdEventListener(AdListenerEvent adListenerEvent) {
        }

        @Override
        void notifyErrorListener(AdException exception) {
        }
    };
    final AdConfiguration adUnitConfiguration = new AdConfiguration();
    mBaseInterstitialAdUnit.init(adUnitConfiguration);
    assertEquals(AdPosition.FULLSCREEN.getValue(), adUnitConfiguration.getAdPositionValue());
}
Also used : Context(android.content.Context) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) Bid(org.prebid.mobile.rendering.bidding.data.bid.Bid) AdException(org.prebid.mobile.rendering.errors.AdException) Before(org.junit.Before)

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