use of org.prebid.mobile.rendering.models.openrtb.bidRequests.Imp in project prebid-mobile-android by prebid.
the class BasicParameterBuilderTest method whenAppendParametersAndVastWithPlacementType_ImpWithValidVideoObject.
@Test
public void whenAppendParametersAndVastWithPlacementType_ImpWithValidVideoObject() throws JSONException {
AdConfiguration adConfiguration = new AdConfiguration();
adConfiguration.setAdUnitIdentifierType(AdConfiguration.AdUnitIdentifierType.VAST);
adConfiguration.setPlacementType(PlacementType.IN_BANNER);
adConfiguration.setAdPosition(AdPosition.FULLSCREEN);
adConfiguration.addSize(new AdSize(300, 250));
BasicParameterBuilder builder = new BasicParameterBuilder(adConfiguration, mContext.getResources(), mBrowserActivityAvailable);
AdRequestInput adRequestInput = new AdRequestInput();
builder.appendBuilderParameters(adRequestInput);
BidRequest actualBidRequest = adRequestInput.getBidRequest();
BidRequest expectedBidRequest = getExpectedBidRequest(adConfiguration, actualBidRequest.getId());
assertEquals(expectedBidRequest.getJsonObject().toString(), actualBidRequest.getJsonObject().toString());
Imp actualImp = actualBidRequest.getImp().get(0);
assertNotNull(actualImp.video);
assertNull(actualImp.banner);
assertNull(actualImp.secure);
assertEquals(1, actualImp.instl.intValue());
assertEquals(300, actualImp.video.w.intValue());
assertEquals(250, actualImp.video.h.intValue());
assertNotEquals(VIDEO_INTERSTITIAL_PLACEMENT, actualImp.video.placement.intValue());
}
use of org.prebid.mobile.rendering.models.openrtb.bidRequests.Imp in project prebid-mobile-android by prebid.
the class BasicParameterBuilderTest method whenAppendParametersAndVastWithoutPlacementType_ImpWithValidVideoObject.
@Test
public void whenAppendParametersAndVastWithoutPlacementType_ImpWithValidVideoObject() throws JSONException {
AdConfiguration adConfiguration = new AdConfiguration();
adConfiguration.setAdUnitIdentifierType(AdConfiguration.AdUnitIdentifierType.VAST);
adConfiguration.setAdPosition(AdPosition.FULLSCREEN);
BasicParameterBuilder builder = new BasicParameterBuilder(adConfiguration, mContext.getResources(), mBrowserActivityAvailable);
AdRequestInput adRequestInput = new AdRequestInput();
builder.appendBuilderParameters(adRequestInput);
BidRequest actualBidRequest = adRequestInput.getBidRequest();
BidRequest expectedBidRequest = getExpectedBidRequest(adConfiguration, actualBidRequest.getId());
assertEquals(expectedBidRequest.getJsonObject().toString(), actualBidRequest.getJsonObject().toString());
Imp actualImp = actualBidRequest.getImp().get(0);
assertNotNull(actualImp.video);
assertNull(actualImp.banner);
assertNull(actualImp.secure);
assertEquals(1920, actualImp.video.w.intValue());
assertEquals(1080, actualImp.video.h.intValue());
assertEquals(VIDEO_INTERSTITIAL_PLACEMENT, actualImp.video.placement.intValue());
assertEquals(1, actualImp.instl.intValue());
}
use of org.prebid.mobile.rendering.models.openrtb.bidRequests.Imp in project prebid-mobile-android by prebid.
the class BasicParameterBuilderTest method whenAppendParametersAndUseExternalBrowserFalseAndBrowserActivityNotAvailable_ClickBrowserEqualsOne.
@Test
public void whenAppendParametersAndUseExternalBrowserFalseAndBrowserActivityNotAvailable_ClickBrowserEqualsOne() {
AdConfiguration adConfiguration = new AdConfiguration();
adConfiguration.setAdUnitIdentifierType(AdConfiguration.AdUnitIdentifierType.BANNER);
adConfiguration.addSize(new AdSize(320, 50));
PrebidRenderingSettings.useExternalBrowser = false;
BasicParameterBuilder builder = new BasicParameterBuilder(adConfiguration, mContext.getResources(), false);
AdRequestInput adRequestInput = new AdRequestInput();
builder.appendBuilderParameters(adRequestInput);
Imp actualImp = adRequestInput.getBidRequest().getImp().get(0);
assertEquals(1, actualImp.clickBrowser.intValue());
}
use of org.prebid.mobile.rendering.models.openrtb.bidRequests.Imp 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.models.openrtb.bidRequests.Imp in project prebid-mobile-android by prebid.
the class BasicParameterBuilder method appendBuilderParameters.
@Override
public void appendBuilderParameters(AdRequestInput adRequestInput) {
final String uuid = UUID.randomUUID().toString();
configureBidRequest(adRequestInput.getBidRequest(), uuid);
configureSource(adRequestInput.getBidRequest().getSource(), uuid);
appendUserTargetingParameters(adRequestInput);
ArrayList<Imp> impsArrayList = adRequestInput.getBidRequest().getImp();
if (impsArrayList != null) {
Imp newImp = new Imp();
configureImpObject(newImp, uuid);
impsArrayList.add(newImp);
}
}
Aggregations