use of org.prebid.mobile.rendering.bidding.data.AdSize in project prebid-mobile-android by prebid.
the class GamBannerEventHandler method convertGamAdSize.
public static AdSize[] convertGamAdSize(com.google.android.gms.ads.AdSize... sizes) {
if (sizes == null) {
return new AdSize[0];
}
AdSize[] adSizes = new AdSize[sizes.length];
for (int i = 0; i < sizes.length; i++) {
com.google.android.gms.ads.AdSize gamAdSize = sizes[i];
adSizes[i] = new AdSize(gamAdSize.getWidth(), gamAdSize.getHeight());
}
return adSizes;
}
use of org.prebid.mobile.rendering.bidding.data.AdSize in project prebid-mobile-android by prebid.
the class MediationBannerAdUnitTest method whenInitAdConfig_PrepareAdConfigForBanner.
@Test
public void whenInitAdConfig_PrepareAdConfigForBanner() {
AdSize adSize = new AdSize(1, 2);
mMediationBannerAdUnit.initAdConfig("config", adSize);
AdConfiguration adConfiguration = mMediationBannerAdUnit.mAdUnitConfig;
assertEquals("config", adConfiguration.getConfigId());
assertEquals(AdConfiguration.AdUnitIdentifierType.BANNER, adConfiguration.getAdUnitIdentifierType());
assertTrue(adConfiguration.getAdSizes().contains(adSize));
}
use of org.prebid.mobile.rendering.bidding.data.AdSize in project prebid-mobile-android by prebid.
the class BasicParameterBuilderTest method whenAppendParametersAndUseExternalBrowserTrueAndBrowserActivityAvailable_ClickBrowserEqualsOne.
@Test
public void whenAppendParametersAndUseExternalBrowserTrueAndBrowserActivityAvailable_ClickBrowserEqualsOne() {
AdConfiguration adConfiguration = new AdConfiguration();
adConfiguration.setAdUnitIdentifierType(AdConfiguration.AdUnitIdentifierType.BANNER);
adConfiguration.addSize(new AdSize(320, 50));
PrebidRenderingSettings.useExternalBrowser = true;
BasicParameterBuilder builder = new BasicParameterBuilder(adConfiguration, mContext.getResources(), mBrowserActivityAvailable);
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.bidding.data.AdSize in project prebid-mobile-android by prebid.
the class BasicParameterBuilderTest method whenAppendParametersAndTargetingParamsWereSet_TargetingParamsWereAppend.
@Test
public void whenAppendParametersAndTargetingParamsWereSet_TargetingParamsWereAppend() throws JSONException {
AdConfiguration adConfiguration = new AdConfiguration();
adConfiguration.setAdUnitIdentifierType(AdConfiguration.AdUnitIdentifierType.BANNER);
adConfiguration.addSize(new AdSize(320, 50));
Targeting.setUserId(USER_ID);
Targeting.setUserAge(USER_AGE);
Targeting.setUserKeywords(USER_KEYWORDS);
Targeting.setUserCustomData(USER_CUSTOM);
Targeting.setUserGender(UserParameters.Gender.MALE);
Targeting.setBuyerUid(USER_BUYER_ID);
Targeting.setUserExt(new Ext());
Targeting.setEids(new JSONArray());
Targeting.setUserLatLng(USER_LAT, USER_LON);
BasicParameterBuilder builder = new BasicParameterBuilder(adConfiguration, mContext.getResources(), mBrowserActivityAvailable);
AdRequestInput adRequestInput = new AdRequestInput();
builder.appendBuilderParameters(adRequestInput);
User actualUser = adRequestInput.getBidRequest().getUser();
User expectedUser = getExpectedUser();
assertEquals(expectedUser.getJsonObject().toString(), actualUser.getJsonObject().toString());
}
use of org.prebid.mobile.rendering.bidding.data.AdSize in project prebid-mobile-android by prebid.
the class BasicParameterBuilderTest method whenAppendParametersAndBannerType_ImpWithValidBannerObject.
@Test
public void whenAppendParametersAndBannerType_ImpWithValidBannerObject() throws JSONException {
AdConfiguration adConfiguration = new AdConfiguration();
adConfiguration.setAdUnitIdentifierType(AdConfiguration.AdUnitIdentifierType.BANNER);
adConfiguration.addSize(new AdSize(320, 50));
adConfiguration.setPbAdSlot("12345");
PrebidRenderingSettings.addStoredBidResponse("bidderTest", "123456");
PrebidRenderingSettings.setStoredAuctionResponse("storedResponse");
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);
assertTrue(actualImp.banner.getFormats().containsAll(expectedBidRequest.getImp().get(0).banner.getFormats()));
assertNull(actualImp.video);
assertEquals(1, actualImp.secure.intValue());
assertEquals(0, actualImp.instl.intValue());
}
Aggregations