use of org.prebid.mobile.rendering.models.openrtb.BidRequest in project prebid-mobile-android by prebid.
the class BasicParameterBuilderTest method getExpectedBidRequest.
private BidRequest getExpectedBidRequest(AdConfiguration adConfiguration, String uuid) {
BidRequest bidRequest = new BidRequest();
bidRequest.setId(uuid);
boolean isVideo = adConfiguration.isAdType(AdConfiguration.AdUnitIdentifierType.VAST);
bidRequest.getExt().put("prebid", Prebid.getJsonObjectForBidRequest(PrebidRenderingSettings.getAccountId(), isVideo));
// if coppaEnabled - set 1, else No coppa is sent
if (PrebidRenderingSettings.isCoppaEnabled) {
bidRequest.getRegs().coppa = 1;
}
Imp imp = getExpectedImp(adConfiguration, uuid);
bidRequest.getImp().add(imp);
Source source = bidRequest.getSource();
source.setTid(uuid);
source.getExt().put(KEY_OM_PARTNER_NAME, OmAdSessionManager.PARTNER_NAME);
source.getExt().put(KEY_OM_PARTNER_VERSION, OmAdSessionManager.PARTNER_VERSION);
bidRequest.getUser();
return bidRequest;
}
use of org.prebid.mobile.rendering.models.openrtb.BidRequest in project prebid-mobile-android by prebid.
the class GeoLocationParameterBuilderTest method testAppendBuilderParameters.
@Test
public void testAppendBuilderParameters() throws Exception {
GeoLocationParameterBuilder builder = new GeoLocationParameterBuilder();
AdRequestInput adRequestInput = new AdRequestInput();
builder.appendBuilderParameters(adRequestInput);
BidRequest expectedBidRequest = new BidRequest();
expectedBidRequest.getDevice().getGeo().lat = LATITUDE.floatValue();
expectedBidRequest.getDevice().getGeo().lon = LONGITUDE.floatValue();
expectedBidRequest.getDevice().getGeo().type = GeoLocationParameterBuilder.LOCATION_SOURCE_GPS;
assertEquals(expectedBidRequest.getJsonObject().toString(), adRequestInput.getBidRequest().getJsonObject().toString());
}
use of org.prebid.mobile.rendering.models.openrtb.BidRequest in project prebid-mobile-android by prebid.
the class AppInfoParameterBuilderTest method testAppendBuilderParameters.
@Test
public void testAppendBuilderParameters() throws Exception {
AdConfiguration adConfiguration = new AdConfiguration();
ContentObject contentObject = new ContentObject();
contentObject.setUrl("test.com");
adConfiguration.setAppContent(contentObject);
AppInfoParameterBuilder builder = new AppInfoParameterBuilder(adConfiguration);
AdRequestInput adRequestInput = new AdRequestInput();
final String expectedStoreurl = "https://google.play.com";
final String expectedPublisherName = "prebid";
Targeting.setPublisherName(expectedPublisherName);
Targeting.setAppStoreMarketUrl(expectedStoreurl);
builder.appendBuilderParameters(adRequestInput);
BidRequest expectedBidRequest = new BidRequest();
final App expectedApp = expectedBidRequest.getApp();
expectedApp.name = APP_NAME;
expectedApp.bundle = APP_BUNDLE;
expectedApp.storeurl = expectedStoreurl;
expectedApp.getPublisher().name = expectedPublisherName;
expectedApp.getExt().put("prebid", Prebid.getJsonObjectForApp(BasicParameterBuilder.DISPLAY_MANAGER_VALUE, PrebidRenderingSettings.SDK_VERSION));
ContentObject expectedContentObject = new ContentObject();
expectedContentObject.setUrl("test.com");
expectedApp.contentObject = expectedContentObject;
assertEquals(expectedBidRequest.getJsonObject().toString(), adRequestInput.getBidRequest().getJsonObject().toString());
}
use of org.prebid.mobile.rendering.models.openrtb.BidRequest in project prebid-mobile-android by prebid.
the class DeviceInfoParameterBuilderTest method testAppendBuilderParameters.
@Test
public void testAppendBuilderParameters() throws Exception {
BidRequest expectedBidRequest = new BidRequest();
final Device expectedBidRequestDevice = expectedBidRequest.getDevice();
final String ipAddress = "192.168.0.1";
final String carrier = "carrier";
AdConfiguration adConfiguration = new AdConfiguration();
ParameterBuilder builder = new DeviceInfoParameterBuilder(adConfiguration);
AdRequestInput adRequestInput = new AdRequestInput();
builder.appendBuilderParameters(adRequestInput);
expectedBidRequestDevice.os = DeviceInfoParameterBuilder.PLATFORM_VALUE;
expectedBidRequestDevice.w = SCREEN_WIDTH;
expectedBidRequestDevice.h = SCREEN_HEIGHT;
expectedBidRequestDevice.language = Locale.getDefault().getLanguage();
expectedBidRequestDevice.osv = "4.4";
expectedBidRequestDevice.os = "Android";
expectedBidRequestDevice.model = "robolectric";
expectedBidRequestDevice.make = "unknown";
expectedBidRequestDevice.pxratio = 1f;
expectedBidRequestDevice.ua = AppInfoManager.getUserAgent();
expectedBidRequestDevice.ifa = AdIdManager.getAdId();
expectedBidRequestDevice.lmt = AdIdManager.isLimitAdTrackingEnabled() ? 1 : 0;
assertJsonEquals(expectedBidRequest.getJsonObject(), adRequestInput.getBidRequest().getJsonObject());
}
use of org.prebid.mobile.rendering.models.openrtb.BidRequest in project prebid-mobile-android by prebid.
the class AutoDetectedOpenRtbTest method overwrittenDeviceInfoParameterBuilder.
@Test
public void overwrittenDeviceInfoParameterBuilder() {
mOriginalOpenRtbParams.getDevice().dpidmd5 = "foo";
mOriginalOpenRtbParams.getDevice().dpidsha1 = "foo";
mOriginalOpenRtbParams.getDevice().w = 0;
mOriginalOpenRtbParams.getDevice().h = 0;
mParamBuilderArray.add(new DeviceInfoParameterBuilder(new AdConfiguration()));
AdRequestInput newAdRequestInput = URLBuilder.buildParameters(mParamBuilderArray, mOriginalAdRequestInput);
BidRequest newOpenRtbParams = newAdRequestInput.getBidRequest();
assertNotEquals(mOriginalOpenRtbParams.getDevice().dpidmd5, newOpenRtbParams.getDevice().dpidmd5);
assertNotEquals(mOriginalOpenRtbParams.getDevice().dpidsha1, newOpenRtbParams.getDevice().dpidsha1);
assertNotEquals(mOriginalOpenRtbParams.getDevice().w, newOpenRtbParams.getDevice().w);
assertNotEquals(mOriginalOpenRtbParams.getDevice().h, newOpenRtbParams.getDevice().h);
}
Aggregations