Search in sources :

Example 1 with AdSize

use of org.prebid.mobile.rendering.bidding.data.AdSize in project prebid-mobile-android by prebid.

the class PublisherAdViewWrapperTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    Context context = Robolectric.buildActivity(Activity.class).create().get();
    mPublisherAdViewWrapper = PublisherAdViewWrapper.newInstance(context, "124", mMockListener, new AdSize(300, 250));
}
Also used : Context(android.content.Context) AdSize(org.prebid.mobile.rendering.bidding.data.AdSize) Before(org.junit.Before)

Example 2 with AdSize

use of org.prebid.mobile.rendering.bidding.data.AdSize in project prebid-mobile-android by prebid.

the class PublisherAdViewWrapperTest method newInstance_WithNullContext_NullValueReturned.

@Test
public void newInstance_WithNullContext_NullValueReturned() {
    PublisherAdViewWrapper publisherAdViewWrapper = PublisherAdViewWrapper.newInstance(null, "124", mMockListener, new AdSize(300, 250));
    assertNull(publisherAdViewWrapper);
}
Also used : AdSize(org.prebid.mobile.rendering.bidding.data.AdSize) Test(org.junit.Test)

Example 3 with AdSize

use of org.prebid.mobile.rendering.bidding.data.AdSize in project prebid-mobile-android by prebid.

the class BasicParameterBuilderTest method whenAppendParametersAndVastWithPlacementType_ImpWithValidVideoObject.

@Test
public void whenAppendParametersAndVastWithPlacementType_ImpWithValidVideoObject() throws JSONException {
    AdConfiguration adConfiguration = new AdConfiguration();
    adConfiguration.setAdUnitIdentifierType(AdConfiguration.AdUnitIdentifierType.VAST);
    adConfiguration.setPlacementType(PlacementType.IN_BANNER);
    adConfiguration.setAdPosition(AdPosition.FULLSCREEN);
    adConfiguration.addSize(new AdSize(300, 250));
    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.video);
    assertNull(actualImp.banner);
    assertNull(actualImp.secure);
    assertEquals(1, actualImp.instl.intValue());
    assertEquals(300, actualImp.video.w.intValue());
    assertEquals(250, actualImp.video.h.intValue());
    assertNotEquals(VIDEO_INTERSTITIAL_PLACEMENT, actualImp.video.placement.intValue());
}
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) Imp(org.prebid.mobile.rendering.models.openrtb.bidRequests.Imp) BidRequest(org.prebid.mobile.rendering.models.openrtb.BidRequest) Test(org.junit.Test)

Example 4 with AdSize

use of org.prebid.mobile.rendering.bidding.data.AdSize in project prebid-mobile-android by prebid.

the class BasicParameterBuilderTest method whenAppendParametersAndCoppaTrue_CoppaEqualsOne.

@Test
public void whenAppendParametersAndCoppaTrue_CoppaEqualsOne() {
    AdConfiguration adConfiguration = new AdConfiguration();
    adConfiguration.setAdUnitIdentifierType(AdConfiguration.AdUnitIdentifierType.BANNER);
    adConfiguration.addSize(new AdSize(320, 50));
    PrebidRenderingSettings.isCoppaEnabled = true;
    BasicParameterBuilder builder = new BasicParameterBuilder(adConfiguration, mContext.getResources(), mBrowserActivityAvailable);
    AdRequestInput adRequestInput = new AdRequestInput();
    builder.appendBuilderParameters(adRequestInput);
    BidRequest actualBidRequest = adRequestInput.getBidRequest();
    assertEquals(1, actualBidRequest.getRegs().coppa.intValue());
}
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 5 with AdSize

use of org.prebid.mobile.rendering.bidding.data.AdSize in project prebid-mobile-android by prebid.

the class BasicParameterBuilderTest method whenAppendParametersAndUseExternalBrowserFalseAndBrowserActivityNotAvailable_ClickBrowserEqualsOne.

@Test
public void whenAppendParametersAndUseExternalBrowserFalseAndBrowserActivityNotAvailable_ClickBrowserEqualsOne() {
    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(), false);
    AdRequestInput adRequestInput = new AdRequestInput();
    builder.appendBuilderParameters(adRequestInput);
    Imp actualImp = adRequestInput.getBidRequest().getImp().get(0);
    assertEquals(1, actualImp.clickBrowser.intValue());
}
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) Imp(org.prebid.mobile.rendering.models.openrtb.bidRequests.Imp) Test(org.junit.Test)

Aggregations

AdSize (org.prebid.mobile.rendering.bidding.data.AdSize)25 Test (org.junit.Test)15 AdConfiguration (org.prebid.mobile.rendering.models.AdConfiguration)15 BasicParameterBuilder (org.prebid.mobile.rendering.networking.parameters.BasicParameterBuilder)9 Imp (org.prebid.mobile.rendering.models.openrtb.bidRequests.Imp)6 Configuration (android.content.res.Configuration)4 BidRequest (org.prebid.mobile.rendering.models.openrtb.BidRequest)4 Banner (org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Banner)2 Video (org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Video)2 SuppressLint (android.annotation.SuppressLint)1 Context (android.content.Context)1 TypedArray (android.content.res.TypedArray)1 HashSet (java.util.HashSet)1 JSONArray (org.json.JSONArray)1 Before (org.junit.Before)1 MockMediationUtils (org.prebid.mobile.rendering.bidding.config.MockMediationUtils)1 Device (org.prebid.mobile.rendering.models.openrtb.bidRequests.Device)1 Ext (org.prebid.mobile.rendering.models.openrtb.bidRequests.Ext)1 User (org.prebid.mobile.rendering.models.openrtb.bidRequests.User)1 DeviceInfoManager (org.prebid.mobile.rendering.sdk.deviceData.managers.DeviceInfoManager)1