Search in sources :

Example 21 with BidRequest

use of org.prebid.mobile.rendering.models.openrtb.BidRequest 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);
}
Also used : AppInfoParameterBuilder(org.prebid.mobile.rendering.networking.parameters.AppInfoParameterBuilder) AdRequestInput(org.prebid.mobile.rendering.networking.parameters.AdRequestInput) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) BidRequest(org.prebid.mobile.rendering.models.openrtb.BidRequest) Test(org.junit.Test)

Example 22 with BidRequest

use of org.prebid.mobile.rendering.models.openrtb.BidRequest 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());
}
Also used : Format(org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.pmps.Format) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) BasicParameterBuilder(org.prebid.mobile.rendering.networking.parameters.BasicParameterBuilder) Imp(org.prebid.mobile.rendering.models.openrtb.bidRequests.Imp) BidRequest(org.prebid.mobile.rendering.models.openrtb.BidRequest) Test(org.junit.Test)

Example 23 with BidRequest

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

the class BasicParameterBuilderTest method whenAppendParametersAndCoppaFalse_CoppaNull.

@Test
public void whenAppendParametersAndCoppaFalse_CoppaNull() {
    AdConfiguration adConfiguration = new AdConfiguration();
    adConfiguration.setAdUnitIdentifierType(AdConfiguration.AdUnitIdentifierType.BANNER);
    adConfiguration.addSize(new AdSize(320, 50));
    BasicParameterBuilder builder = new BasicParameterBuilder(adConfiguration, mContext.getResources(), mBrowserActivityAvailable);
    AdRequestInput adRequestInput = new AdRequestInput();
    builder.appendBuilderParameters(adRequestInput);
    BidRequest actualBidRequest = adRequestInput.getBidRequest();
    assertNull(actualBidRequest.getRegs().coppa);
}
Also used : AdSize(org.prebid.mobile.rendering.bidding.data.AdSize) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) BasicParameterBuilder(org.prebid.mobile.rendering.networking.parameters.BasicParameterBuilder) BidRequest(org.prebid.mobile.rendering.models.openrtb.BidRequest) Test(org.junit.Test)

Example 24 with BidRequest

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

the class UserConsentParameterBuilder method appendBuilderParameters.

@Override
public void appendBuilderParameters(AdRequestInput adRequestInput) {
    BidRequest bidRequest = adRequestInput.getBidRequest();
    appendGdprParameter(bidRequest);
    appendCcpaParameter(bidRequest);
}
Also used : BidRequest(org.prebid.mobile.rendering.models.openrtb.BidRequest)

Aggregations

BidRequest (org.prebid.mobile.rendering.models.openrtb.BidRequest)24 Test (org.junit.Test)20 AdConfiguration (org.prebid.mobile.rendering.models.AdConfiguration)11 AdRequestInput (org.prebid.mobile.rendering.networking.parameters.AdRequestInput)8 BasicParameterBuilder (org.prebid.mobile.rendering.networking.parameters.BasicParameterBuilder)7 Imp (org.prebid.mobile.rendering.models.openrtb.bidRequests.Imp)5 AdSize (org.prebid.mobile.rendering.bidding.data.AdSize)4 NetworkInfo (android.net.NetworkInfo)2 JSONObject (org.json.JSONObject)2 Device (org.prebid.mobile.rendering.models.openrtb.bidRequests.Device)2 Activity (android.app.Activity)1 Location (android.location.Location)1 LocationManager (android.location.LocationManager)1 JSONArray (org.json.JSONArray)1 JSONException (org.json.JSONException)1 Before (org.junit.Before)1 ContentObject (org.prebid.mobile.ContentObject)1 App (org.prebid.mobile.rendering.models.openrtb.bidRequests.App)1 User (org.prebid.mobile.rendering.models.openrtb.bidRequests.User)1 Geo (org.prebid.mobile.rendering.models.openrtb.bidRequests.devices.Geo)1