Search in sources :

Example 46 with AdConfiguration

use of org.prebid.mobile.rendering.models.AdConfiguration 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 47 with AdConfiguration

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

the class BasicParameterBuilderTest method whenAppendParametersAndAdConfigContextDataNotEmpty_ContextDataAddedToImpExt.

@Test
public void whenAppendParametersAndAdConfigContextDataNotEmpty_ContextDataAddedToImpExt() throws JSONException {
    AdConfiguration adConfiguration = new AdConfiguration();
    adConfiguration.addContextData("context", "contextData");
    BasicParameterBuilder builder = new BasicParameterBuilder(adConfiguration, mContext.getResources(), false);
    AdRequestInput adRequestInput = new AdRequestInput();
    builder.appendBuilderParameters(adRequestInput);
    Ext impExt = adRequestInput.getBidRequest().getImp().get(0).getExt();
    assertTrue(impExt.getMap().containsKey("context"));
    JSONObject contextDataJson = ((JSONObject) impExt.getMap().get("context")).getJSONObject("data");
    assertTrue(contextDataJson.has("context"));
    assertEquals("contextData", contextDataJson.getJSONArray("context").get(0));
}
Also used : Ext(org.prebid.mobile.rendering.models.openrtb.bidRequests.Ext) JSONObject(org.json.JSONObject) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) BasicParameterBuilder(org.prebid.mobile.rendering.networking.parameters.BasicParameterBuilder) Test(org.junit.Test)

Example 48 with AdConfiguration

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

the class InterstitialAdUnitTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    mContext = Robolectric.buildActivity(Activity.class).create().get();
    mInterstitialAdUnit = new InterstitialAdUnit(mContext, CONFIGURATION_ID, AD_SIZE, mMockInterstitialEventHandler);
    mInterstitialAdUnit.setInterstitialAdUnitListener(mMockInterstitialAdUnitListener);
    WhiteBox.setInternalState(mInterstitialAdUnit, "mBidLoader", mMockBidLoader);
    WhiteBox.setInternalState(mInterstitialAdUnit, "mInterstitialController", mMockInterstitialController);
    final AdConfiguration adUnitConfig = mInterstitialAdUnit.mAdUnitConfig;
    assertEquals(AdPosition.FULLSCREEN.getValue(), adUnitConfig.getAdPositionValue());
}
Also used : AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) Activity(android.app.Activity) Before(org.junit.Before)

Example 49 with AdConfiguration

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

the class VideoViewTest method loadAd_vastXml_StopVisibilityTrackingChangeStateToUndefined.

@Test
public void loadAd_vastXml_StopVisibilityTrackingChangeStateToUndefined() {
    changeVideoViewState(PAUSED_AUTO);
    mVideoView.loadAd(new AdConfiguration(), "somexml");
    VideoView.State stateAfterLoad = WhiteBox.getInternalState(mVideoView, "mVideoViewState");
    assertEquals(UNDEFINED, stateAfterLoad);
    verify(mMockVisibilityTracker).stopVisibilityCheck();
}
Also used : AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) Test(org.junit.Test)

Example 50 with AdConfiguration

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

the class RewardedAdUnitTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    mContext = Robolectric.buildActivity(Activity.class).create().get();
    mRewardedAdUnit = new RewardedAdUnit(mContext, CONFIGURATION_ID, mMockRewardedEventHandler);
    mRewardedAdUnit.setRewardedAdUnitListener(mMockRewardedAdUnitListener);
    WhiteBox.setInternalState(mRewardedAdUnit, "mBidLoader", mMockBidLoader);
    WhiteBox.setInternalState(mRewardedAdUnit, "mInterstitialController", mMockInterstitialController);
    final AdConfiguration adUnitConfig = mRewardedAdUnit.mAdUnitConfig;
    assertEquals(AdPosition.FULLSCREEN.getValue(), adUnitConfig.getAdPositionValue());
}
Also used : AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) Activity(android.app.Activity) Before(org.junit.Before)

Aggregations

AdConfiguration (org.prebid.mobile.rendering.models.AdConfiguration)57 Test (org.junit.Test)38 BasicParameterBuilder (org.prebid.mobile.rendering.networking.parameters.BasicParameterBuilder)15 AdSize (org.prebid.mobile.rendering.bidding.data.AdSize)13 BidRequest (org.prebid.mobile.rendering.models.openrtb.BidRequest)11 Before (org.junit.Before)8 Imp (org.prebid.mobile.rendering.models.openrtb.bidRequests.Imp)8 Context (android.content.Context)6 JSONObject (org.json.JSONObject)6 BidResponse (org.prebid.mobile.rendering.bidding.data.bid.BidResponse)6 Activity (android.app.Activity)5 AdException (org.prebid.mobile.rendering.errors.AdException)5 AbstractCreative (org.prebid.mobile.rendering.models.AbstractCreative)5 VideoCreativeModel (org.prebid.mobile.rendering.video.VideoCreativeModel)5 AdViewManager (org.prebid.mobile.rendering.views.AdViewManager)5 Handler (android.os.Handler)3 JSONArray (org.json.JSONArray)3 HTMLCreative (org.prebid.mobile.rendering.models.HTMLCreative)3 Ext (org.prebid.mobile.rendering.models.openrtb.bidRequests.Ext)3 User (org.prebid.mobile.rendering.models.openrtb.bidRequests.User)3