Search in sources :

Example 6 with AdRequestInput

use of org.prebid.mobile.rendering.networking.parameters.AdRequestInput in project prebid-mobile-android by prebid.

the class BidUrlComponentsTest method whenGetQueryArgString_ReturnBidRequestJson.

@Test
public void whenGetQueryArgString_ReturnBidRequestJson() throws JSONException {
    AdRequestInput adRequestInput = new AdRequestInput();
    BidRequest mockBidRequest = mock(BidRequest.class);
    JSONObject jsonObject = new JSONObject();
    jsonObject.put("test", "test");
    when(mockBidRequest.getJsonObject()).thenReturn(jsonObject);
    adRequestInput.setBidRequest(mockBidRequest);
    BidUrlComponents bidUrlComponents = new BidUrlComponents("", adRequestInput);
    assertEquals(jsonObject.toString(), bidUrlComponents.getQueryArgString());
}
Also used : AdRequestInput(org.prebid.mobile.rendering.networking.parameters.AdRequestInput) JSONObject(org.json.JSONObject) BidRequest(org.prebid.mobile.rendering.models.openrtb.BidRequest) Test(org.junit.Test)

Example 7 with AdRequestInput

use of org.prebid.mobile.rendering.networking.parameters.AdRequestInput in project prebid-mobile-android by prebid.

the class URLBuilderTest method testBuildURLObject.

@Test
public void testBuildURLObject() {
    URLPathBuilder mockPathBuilder = mock(URLPathBuilder.class);
    ArrayList<ParameterBuilder> parameterBuilders = new ArrayList<>();
    URLBuilder urlBuilder = new URLBuilder(mockPathBuilder, parameterBuilders, new AdRequestInput());
    assertNotNull(urlBuilder);
}
Also used : AdRequestInput(org.prebid.mobile.rendering.networking.parameters.AdRequestInput) ArrayList(java.util.ArrayList) ParameterBuilder(org.prebid.mobile.rendering.networking.parameters.ParameterBuilder) Test(org.junit.Test)

Example 8 with AdRequestInput

use of org.prebid.mobile.rendering.networking.parameters.AdRequestInput in project prebid-mobile-android by prebid.

the class BidRequesterTest method setUp.

@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    mContext = Robolectric.buildActivity(Activity.class).create().get();
    mAdConfiguration = new AdConfiguration();
    mAdRequestInput = new AdRequestInput();
    ManagersResolver.getInstance().prepare(mContext);
}
Also used : AdRequestInput(org.prebid.mobile.rendering.networking.parameters.AdRequestInput) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) Activity(android.app.Activity) Before(org.junit.Before)

Example 9 with AdRequestInput

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

Example 10 with AdRequestInput

use of org.prebid.mobile.rendering.networking.parameters.AdRequestInput 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)

Aggregations

AdRequestInput (org.prebid.mobile.rendering.networking.parameters.AdRequestInput)14 Test (org.junit.Test)10 BidRequest (org.prebid.mobile.rendering.models.openrtb.BidRequest)8 AdConfiguration (org.prebid.mobile.rendering.models.AdConfiguration)3 Activity (android.app.Activity)2 Before (org.junit.Before)2 Location (android.location.Location)1 LocationManager (android.location.LocationManager)1 ArrayList (java.util.ArrayList)1 JSONException (org.json.JSONException)1 JSONObject (org.json.JSONObject)1 Device (org.prebid.mobile.rendering.models.openrtb.bidRequests.Device)1 BidRequester (org.prebid.mobile.rendering.networking.modelcontrollers.BidRequester)1 AppInfoParameterBuilder (org.prebid.mobile.rendering.networking.parameters.AppInfoParameterBuilder)1 DeviceInfoParameterBuilder (org.prebid.mobile.rendering.networking.parameters.DeviceInfoParameterBuilder)1 GeoLocationParameterBuilder (org.prebid.mobile.rendering.networking.parameters.GeoLocationParameterBuilder)1 NetworkParameterBuilder (org.prebid.mobile.rendering.networking.parameters.NetworkParameterBuilder)1 ParameterBuilder (org.prebid.mobile.rendering.networking.parameters.ParameterBuilder)1 ShadowActivity (org.robolectric.shadows.ShadowActivity)1 ShadowLocationManager (org.robolectric.shadows.ShadowLocationManager)1