Search in sources :

Example 31 with AdConfiguration

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

the class PrebidBannerAdapter method initDisplayView.

private void initDisplayView(Context context, String responseId) {
    try {
        AdConfiguration adUnitConfiguration = new AdConfiguration();
        adUnitConfiguration.setAdUnitIdentifierType(AdConfiguration.AdUnitIdentifierType.BANNER);
        mDisplayView = new DisplayView(context, mDisplayViewListener, adUnitConfiguration, responseId);
    } catch (AdException e) {
        MoPubLog.log(MoPubLog.AdapterLogEvent.LOAD_FAILED, TAG);
        mLoadListener.onAdLoadFailed(MoPubErrorCode.ADAPTER_CONFIGURATION_ERROR);
    }
}
Also used : AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) DisplayView(org.prebid.mobile.rendering.bidding.display.DisplayView) AdException(org.prebid.mobile.rendering.errors.AdException)

Example 32 with AdConfiguration

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

the class InterstitialVideoTest method whenVastAndSscOffsetPresent_UseSscOffset.

@Test
public void whenVastAndSscOffsetPresent_UseSscOffset() throws Exception {
    Context context = mock(Context.class);
    AdViewManager adViewManager = new AdViewManager(context, mock(AdViewManagerListener.class), mMockAdView, mMockInterstitialManager);
    AdConfiguration adConfiguration = adViewManager.getAdConfiguration();
    adConfiguration.setVideoSkipOffset(10000);
    AbstractCreative mockCreative = mock(AbstractCreative.class);
    VideoCreativeModel mockModel = mock(VideoCreativeModel.class);
    when(mockModel.getSkipOffset()).thenReturn(20000L);
    when(mockCreative.getCreativeModel()).thenReturn(mockModel);
    WhiteBox.field(AdViewManager.class, "mCurrentCreative").set(adViewManager, mockCreative);
    when(mMockAdView.getMediaOffset()).thenReturn(adViewManager.getSkipOffset());
    mSpyInterstitialVideo.scheduleShowCloseBtnTask(mMockAdView);
    verify(mSpyInterstitialVideo).scheduleTimer(10L * 1000);
}
Also used : Context(android.content.Context) AbstractCreative(org.prebid.mobile.rendering.models.AbstractCreative) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) AdViewManager(org.prebid.mobile.rendering.views.AdViewManager) AdViewManagerListener(org.prebid.mobile.rendering.views.AdViewManagerListener) VideoCreativeModel(org.prebid.mobile.rendering.video.VideoCreativeModel) Test(org.junit.Test)

Example 33 with AdConfiguration

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

the class PrebidWebViewInterstitialTest method loadHTMLTest.

@Test
public void loadHTMLTest() throws IOException {
    mPrebidWebViewInterstitial.mCreative = mock(HTMLCreative.class);
    CreativeModel mockModel = mock(CreativeModel.class);
    when(mPrebidWebViewInterstitial.mCreative.getCreativeModel()).thenReturn(mockModel);
    when(mockModel.getHtml()).thenReturn(ResourceUtils.convertResourceToString("ad_contains_iframe"));
    when(mockModel.getAdConfiguration()).thenReturn(new AdConfiguration());
    mPrebidWebViewInterstitial.loadHTML(mAdHTML, 100, 200);
    assertNotNull(mPrebidWebViewInterstitial.mWebView);
    assertEquals("WebViewInterstitial", mPrebidWebViewInterstitial.mWebView.mMRAIDBridgeName);
}
Also used : CreativeModel(org.prebid.mobile.rendering.models.CreativeModel) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) HTMLCreative(org.prebid.mobile.rendering.models.HTMLCreative) Test(org.junit.Test)

Example 34 with AdConfiguration

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

the class VideoCreativeModelTest method setup.

@Before
public void setup() {
    AdConfiguration adConfiguration = mock(AdConfiguration.class);
    mMockOmEventTracker = mock(OmEventTracker.class);
    mMockTrackingManager = mock(TrackingManager.class);
    mVideoCreativeModel = new VideoCreativeModel(mMockTrackingManager, mMockOmEventTracker, adConfiguration);
}
Also used : TrackingManager(org.prebid.mobile.rendering.networking.tracking.TrackingManager) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) Before(org.junit.Before)

Example 35 with AdConfiguration

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

the class VideoCreativeTest method setUp.

@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    mContext = Robolectric.buildActivity(Activity.class).create().get();
    AdConfiguration mockConfig = mock(AdConfiguration.class);
    when(mMockModel.getAdConfiguration()).thenReturn(mockConfig);
    mVideoCreative = new VideoCreative(mContext, mMockModel, mMockOmAdSessionManager, mMockInterstitialManager);
    mVideoCreative.mVideoCreativeView = mMockVideoCreativeView;
}
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