use of org.prebid.mobile.rendering.bidding.data.AdSize in project prebid-mobile-android by prebid.
the class BasicParameterBuilderTest method whenAppendParametersAndSendMraidSupportParamsFalse_NoMraidApi.
@Test
public void whenAppendParametersAndSendMraidSupportParamsFalse_NoMraidApi() {
AdConfiguration adConfiguration = new AdConfiguration();
adConfiguration.setAdUnitIdentifierType(AdConfiguration.AdUnitIdentifierType.BANNER);
adConfiguration.addSize(new AdSize(320, 50));
PrebidRenderingSettings.sendMraidSupportParams = false;
BasicParameterBuilder builder = new BasicParameterBuilder(adConfiguration, mContext.getResources(), mBrowserActivityAvailable);
AdRequestInput adRequestInput = new AdRequestInput();
builder.appendBuilderParameters(adRequestInput);
Imp actualImp = adRequestInput.getBidRequest().getImp().get(0);
assertEquals(Arrays.toString(new int[] { 7 }), Arrays.toString(actualImp.banner.api));
}
use of org.prebid.mobile.rendering.bidding.data.AdSize in project prebid-mobile-android by prebid.
the class BasicParameterBuilderTest method getExpectedVideoImpValues.
private Video getExpectedVideoImpValues(Imp imp, AdConfiguration adConfiguration) {
Video video = new Video();
// Common values for all video reqs
video.mimes = BasicParameterBuilder.SUPPORTED_VIDEO_MIME_TYPES;
video.protocols = BasicParameterBuilder.SUPPORTED_VIDEO_PROTOCOLS;
video.linearity = BasicParameterBuilder.VIDEO_LINEARITY_LINEAR;
// Interstitial video specific values
// On Leaving Viewport or when Terminated by User
video.playbackend = VIDEO_INTERSTITIAL_PLAYBACK_END;
video.delivery = new int[] { BasicParameterBuilder.VIDEO_DELIVERY_DOWNLOAD };
video.pos = AdPosition.FULLSCREEN.getValue();
if (!adConfiguration.isPlacementTypeValid()) {
video.placement = VIDEO_INTERSTITIAL_PLACEMENT;
Configuration deviceConfiguration = mContext.getResources().getConfiguration();
video.w = deviceConfiguration.screenWidthDp;
video.h = deviceConfiguration.screenHeightDp;
} else {
video.placement = adConfiguration.getPlacementTypeValue();
for (AdSize size : adConfiguration.getAdSizes()) {
video.w = size.width;
video.h = size.height;
break;
}
}
return video;
}
use of org.prebid.mobile.rendering.bidding.data.AdSize in project prebid-mobile-android by prebid.
the class BasicParameterBuilderTest method getExpectedBannerImpValues.
private Banner getExpectedBannerImpValues(Imp imp, AdConfiguration adConfiguration) {
Banner banner = new Banner();
banner.api = new int[] { 3, 5, 6, 7 };
if (adConfiguration.isAdType(AdConfiguration.AdUnitIdentifierType.BANNER)) {
for (AdSize size : adConfiguration.getAdSizes()) {
banner.addFormat(size.width, size.height);
}
} else if (adConfiguration.isAdType(AdConfiguration.AdUnitIdentifierType.INTERSTITIAL)) {
Configuration deviceConfiguration = mContext.getResources().getConfiguration();
banner.addFormat(deviceConfiguration.screenWidthDp, deviceConfiguration.screenHeightDp);
}
if (adConfiguration.isAdPositionValid()) {
banner.pos = adConfiguration.getAdPositionValue();
}
return banner;
}
use of org.prebid.mobile.rendering.bidding.data.AdSize in project prebid-mobile-android by prebid.
the class BasicParameterBuilder method setBannerImpValues.
private void setBannerImpValues(Imp imp) {
Banner banner = new Banner();
banner.api = getApiFrameworks();
if (mAdConfiguration.isAdType(AdUnitIdentifierType.BANNER)) {
for (AdSize size : mAdConfiguration.getAdSizes()) {
banner.addFormat(size.width, size.height);
}
} else if (mAdConfiguration.isAdType(AdUnitIdentifierType.INTERSTITIAL) && mResources != null) {
Configuration deviceConfiguration = mResources.getConfiguration();
banner.addFormat(deviceConfiguration.screenWidthDp, deviceConfiguration.screenHeightDp);
}
if (mAdConfiguration.isAdPositionValid()) {
banner.pos = mAdConfiguration.getAdPositionValue();
}
imp.banner = banner;
}
use of org.prebid.mobile.rendering.bidding.data.AdSize 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());
}
Aggregations