use of org.prebid.mobile.rendering.networking.parameters.BasicParameterBuilder in project prebid-mobile-android by prebid.
the class BasicParameterBuilderTest method whenAppendParametersAndTargetingAccessControlNotEmpty_BiddersAddedToExt.
@Test
public void whenAppendParametersAndTargetingAccessControlNotEmpty_BiddersAddedToExt() throws JSONException {
Targeting.addBidderToAccessControlList("bidder");
AdConfiguration adConfiguration = new AdConfiguration();
adConfiguration.setConfigId("config");
BasicParameterBuilder builder = new BasicParameterBuilder(adConfiguration, mContext.getResources(), false);
AdRequestInput adRequestInput = new AdRequestInput();
builder.appendBuilderParameters(adRequestInput);
BidRequest bidRequest = adRequestInput.getBidRequest();
JSONObject prebidJson = bidRequest.getExt().getJsonObject().getJSONObject("prebid");
assertTrue(prebidJson.has("data"));
JSONArray biddersArray = prebidJson.getJSONObject("data").getJSONArray("bidders");
assertEquals("bidder", biddersArray.get(0));
}
use of org.prebid.mobile.rendering.networking.parameters.BasicParameterBuilder 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.networking.parameters.BasicParameterBuilder in project prebid-mobile-android by prebid.
the class BasicParameterBuilderTest method whenAppendUserData_UserDataAddedToUser.
@Test
public void whenAppendUserData_UserDataAddedToUser() throws JSONException {
AdConfiguration adConfiguration = new AdConfiguration();
adConfiguration.setConfigId("config");
DataObject dataObject = new DataObject();
String testName = "testDataObject";
dataObject.setName(testName);
adConfiguration.addUserData(dataObject);
BasicParameterBuilder builder = new BasicParameterBuilder(adConfiguration, mContext.getResources(), false);
AdRequestInput adRequestInput = new AdRequestInput();
builder.appendBuilderParameters(adRequestInput);
User user = adRequestInput.getBidRequest().getUser();
assertEquals(1, user.dataObjects.size());
JSONObject jsonUser = user.getJsonObject();
assertTrue(jsonUser.has("data"));
JSONArray jsonData = jsonUser.getJSONArray("data");
JSONObject jsonDataObject = jsonData.getJSONObject(0);
assertTrue(jsonDataObject.has("name"));
String dataName = jsonDataObject.getString("name");
assertEquals(testName, dataName);
}
use of org.prebid.mobile.rendering.networking.parameters.BasicParameterBuilder in project prebid-mobile-android by prebid.
the class Requester method getParameterBuilders.
protected List<ParameterBuilder> getParameterBuilders() {
Context context = mContextReference.get();
Resources resources = null;
if (context != null) {
resources = context.getResources();
}
boolean browserActivityAvailable = ExternalViewerUtils.isBrowserActivityCallable(context);
ArrayList<ParameterBuilder> parameterBuilderArray = new ArrayList<>();
parameterBuilderArray.add(new BasicParameterBuilder(mAdConfiguration, resources, browserActivityAvailable));
parameterBuilderArray.add(new GeoLocationParameterBuilder());
parameterBuilderArray.add(new AppInfoParameterBuilder(mAdConfiguration));
parameterBuilderArray.add(new DeviceInfoParameterBuilder(mAdConfiguration));
parameterBuilderArray.add(new NetworkParameterBuilder());
parameterBuilderArray.add(new UserConsentParameterBuilder(mUserConsentManager));
return parameterBuilderArray;
}
use of org.prebid.mobile.rendering.networking.parameters.BasicParameterBuilder 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());
}
Aggregations