use of org.prebid.mobile.rendering.models.AdConfiguration 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.AdConfiguration 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);
}
use of org.prebid.mobile.rendering.models.AdConfiguration in project prebid-mobile-android by prebid.
the class AutoDetectedOpenRtbTest method overwrittenAppInfoParameterBuilder.
@Test
public void overwrittenAppInfoParameterBuilder() {
mOriginalOpenRtbParams.getApp().name = "foo";
mOriginalOpenRtbParams.getApp().bundle = "foo";
mOriginalOpenRtbParams.getDevice().ifa = "foo";
mOriginalOpenRtbParams.getDevice().lmt = 0;
AppInfoManager.setAppName("bar");
AppInfoManager.setPackageName("bar");
AdIdManager.setAdId("bar");
AdIdManager.setLimitAdTrackingEnabled(true);
mParamBuilderArray.add(new AppInfoParameterBuilder(new AdConfiguration()));
AdRequestInput newAdRequestInput = URLBuilder.buildParameters(mParamBuilderArray, mOriginalAdRequestInput);
BidRequest newOpenRtbParams = newAdRequestInput.getBidRequest();
assertNotEquals(mOriginalOpenRtbParams.getApp().name, newOpenRtbParams.getApp().name);
assertNotEquals(mOriginalOpenRtbParams.getApp().bundle, newOpenRtbParams.getApp().bundle);
assertNotEquals(mOriginalOpenRtbParams.getDevice().ifa, newOpenRtbParams.getDevice().ifa);
assertNotEquals(mOriginalOpenRtbParams.getDevice().lmt, newOpenRtbParams.getDevice().lmt);
}
use of org.prebid.mobile.rendering.models.AdConfiguration in project prebid-mobile-android by prebid.
the class BasicParameterBuilderTest method whenAppendParametersAndUseExternalBrowserFalseAndBrowserActivityAvailable_ClickBrowserEqualsZero.
@Test
public void whenAppendParametersAndUseExternalBrowserFalseAndBrowserActivityAvailable_ClickBrowserEqualsZero() {
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(), mBrowserActivityAvailable);
AdRequestInput adRequestInput = new AdRequestInput();
builder.appendBuilderParameters(adRequestInput);
Imp actualImp = adRequestInput.getBidRequest().getImp().get(0);
assertEquals(0, actualImp.clickBrowser.intValue());
}
use of org.prebid.mobile.rendering.models.AdConfiguration in project prebid-mobile-android by prebid.
the class BasicParameterBuilderTest method whenAppendParametersAndBInterstitialType_ImpWithValidBannerObject.
@Test
public void whenAppendParametersAndBInterstitialType_ImpWithValidBannerObject() throws JSONException {
AdConfiguration adConfiguration = new AdConfiguration();
adConfiguration.setAdUnitIdentifierType(AdConfiguration.AdUnitIdentifierType.INTERSTITIAL);
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.banner);
Format expectedFormat = new Format(1920, 1080);
assertTrue(actualImp.banner.getFormats().contains(expectedFormat));
assertNull(actualImp.video);
assertEquals(1, actualImp.secure.intValue());
assertEquals(1, actualImp.instl.intValue());
}
Aggregations