Search in sources :

Example 1 with BidLoader

use of org.prebid.mobile.rendering.bidding.loader.BidLoader in project prebid-mobile-android by prebid.

the class RewardedAdUnitTest method createRewardedAdUnitNoEventHandler_InstanceCreatedStandaloneEventHandlerProvidedBidLoaderIsNotNull.

@Test
public void createRewardedAdUnitNoEventHandler_InstanceCreatedStandaloneEventHandlerProvidedBidLoaderIsNotNull() {
    RewardedAdUnit rewardedAdUnit = new RewardedAdUnit(mContext, CONFIGURATION_ID);
    Object eventHandler = WhiteBox.getInternalState(rewardedAdUnit, "mEventHandler");
    BidLoader bidLoader = ((BidLoader) WhiteBox.getInternalState(rewardedAdUnit, "mBidLoader"));
    assertNotNull(rewardedAdUnit);
    assertTrue(eventHandler instanceof StandaloneRewardedVideoEventHandler);
    assertNotNull(bidLoader);
}
Also used : BidLoader(org.prebid.mobile.rendering.bidding.loader.BidLoader) StandaloneRewardedVideoEventHandler(org.prebid.mobile.rendering.bidding.interfaces.StandaloneRewardedVideoEventHandler) Test(org.junit.Test)

Example 2 with BidLoader

use of org.prebid.mobile.rendering.bidding.loader.BidLoader in project prebid-mobile-android by prebid.

the class BannerView method initBidLoader.

private void initBidLoader() {
    mBidLoader = new BidLoader(getContext(), mAdUnitConfig, mBidRequesterListener);
    final VisibilityTrackerOption visibilityTrackerOption = new VisibilityTrackerOption(NativeEventTracker.EventType.IMPRESSION);
    final VisibilityChecker visibilityChecker = new VisibilityChecker(visibilityTrackerOption);
    mBidLoader.setBidRefreshListener(() -> {
        if (mAdFailed) {
            mAdFailed = false;
            return true;
        }
        final boolean isWindowVisibleToUser = mScreenStateReceiver.isScreenOn();
        return visibilityChecker.isVisibleForRefresh(this) && isWindowVisibleToUser;
    });
}
Also used : VisibilityChecker(org.prebid.mobile.rendering.utils.helpers.VisibilityChecker) BidLoader(org.prebid.mobile.rendering.bidding.loader.BidLoader) VisibilityTrackerOption(org.prebid.mobile.rendering.models.internal.VisibilityTrackerOption)

Example 3 with BidLoader

use of org.prebid.mobile.rendering.bidding.loader.BidLoader in project prebid-mobile-android by prebid.

the class BannerViewTest method createPrebidBannerViewNoEventHandler_InstanceCreatedAndBidLoaderIsNotNullAndStandaloneEventHandlerProvided.

@Test
public void createPrebidBannerViewNoEventHandler_InstanceCreatedAndBidLoaderIsNotNullAndStandaloneEventHandlerProvided() throws IllegalAccessException {
    BannerView bannerView = new BannerView(mMockContext, AD_UNIT_ID, AD_SIZE);
    Object eventHandler = WhiteBox.field(BannerView.class, "mEventHandler").get(bannerView);
    BidLoader bidLoader = ((BidLoader) WhiteBox.field(BannerView.class, "mBidLoader").get(bannerView));
    assertNotNull(bannerView);
    assertTrue(eventHandler instanceof StandaloneBannerEventHandler);
    assertNotNull(bidLoader);
}
Also used : StandaloneBannerEventHandler(org.prebid.mobile.rendering.bidding.interfaces.StandaloneBannerEventHandler) BidLoader(org.prebid.mobile.rendering.bidding.loader.BidLoader) Test(org.junit.Test)

Example 4 with BidLoader

use of org.prebid.mobile.rendering.bidding.loader.BidLoader in project prebid-mobile-android by prebid.

the class InterstitialAdUnitTest method createInterstitialAdUnitNoEventHandler_InstanceCreatedStandaloneEventHandlerProvidedBidLoaderIsNotNull.

@Test
public void createInterstitialAdUnitNoEventHandler_InstanceCreatedStandaloneEventHandlerProvidedBidLoaderIsNotNull() {
    InterstitialAdUnit interstitialAdUnit = new InterstitialAdUnit(mContext, CONFIGURATION_ID, AdUnitFormat.VIDEO);
    Object eventHandler = WhiteBox.getInternalState(interstitialAdUnit, "mEventHandler");
    BidLoader bidLoader = ((BidLoader) WhiteBox.getInternalState(interstitialAdUnit, "mBidLoader"));
    assertNotNull(interstitialAdUnit);
    assertTrue(eventHandler instanceof StandaloneInterstitialEventHandler);
    assertNotNull(bidLoader);
}
Also used : BidLoader(org.prebid.mobile.rendering.bidding.loader.BidLoader) StandaloneInterstitialEventHandler(org.prebid.mobile.rendering.bidding.interfaces.StandaloneInterstitialEventHandler) Test(org.junit.Test)

Aggregations

BidLoader (org.prebid.mobile.rendering.bidding.loader.BidLoader)4 Test (org.junit.Test)3 StandaloneBannerEventHandler (org.prebid.mobile.rendering.bidding.interfaces.StandaloneBannerEventHandler)1 StandaloneInterstitialEventHandler (org.prebid.mobile.rendering.bidding.interfaces.StandaloneInterstitialEventHandler)1 StandaloneRewardedVideoEventHandler (org.prebid.mobile.rendering.bidding.interfaces.StandaloneRewardedVideoEventHandler)1 VisibilityTrackerOption (org.prebid.mobile.rendering.models.internal.VisibilityTrackerOption)1 VisibilityChecker (org.prebid.mobile.rendering.utils.helpers.VisibilityChecker)1