Search in sources :

Example 1 with InterstitialController

use of org.prebid.mobile.rendering.bidding.display.InterstitialController in project prebid-mobile-android by prebid.

the class RewardedAdUnitTest method onFailedAndWithWinnerBid_ExecuteInterstitialControllerLoadAd.

@Test
public void onFailedAndWithWinnerBid_ExecuteInterstitialControllerLoadAd() throws IllegalAccessException {
    final BidResponse mockBidResponse = mock(BidResponse.class);
    final InterstitialController mockInterstitialController = mock(InterstitialController.class);
    final Bid mockBid = mock(Bid.class);
    final RewardedVideoEventListener spyEventListener = spy(getEventListener());
    when(mockBidResponse.getWinningBid()).thenReturn(mockBid);
    WhiteBox.setInternalState(mRewardedAdUnit, "mBidResponse", mockBidResponse);
    WhiteBox.setInternalState(mRewardedAdUnit, "mInterstitialController", mockInterstitialController);
    spyEventListener.onAdFailed(new AdException(AdException.INTERNAL_ERROR, "Test"));
    verify(spyEventListener, times(1)).onPrebidSdkWin();
    verify(mockInterstitialController, times(1)).loadAd(any(), any());
}
Also used : InterstitialController(org.prebid.mobile.rendering.bidding.display.InterstitialController) BidResponse(org.prebid.mobile.rendering.bidding.data.bid.BidResponse) Bid(org.prebid.mobile.rendering.bidding.data.bid.Bid) RewardedVideoEventListener(org.prebid.mobile.rendering.bidding.listeners.RewardedVideoEventListener) AdException(org.prebid.mobile.rendering.errors.AdException) Test(org.junit.Test)

Example 2 with InterstitialController

use of org.prebid.mobile.rendering.bidding.display.InterstitialController in project prebid-mobile-android by prebid.

the class InterstitialAdUnitTest method showWhenAuctionWinnerIsPrebid_ShowPrebid.

@Test
public void showWhenAuctionWinnerIsPrebid_ShowPrebid() {
    final InterstitialController mockInterstitialController = mock(InterstitialController.class);
    changeInterstitialState(READY_TO_DISPLAY_PREBID);
    WhiteBox.setInternalState(mInterstitialAdUnit, "mInterstitialController", mockInterstitialController);
    mInterstitialAdUnit.show();
    verify(mockInterstitialController, times(1)).show();
}
Also used : InterstitialController(org.prebid.mobile.rendering.bidding.display.InterstitialController) Test(org.junit.Test)

Example 3 with InterstitialController

use of org.prebid.mobile.rendering.bidding.display.InterstitialController in project prebid-mobile-android by prebid.

the class PrebidInterstitialAdapter method initInterstitialController.

private void initInterstitialController(Context context, String responseId) {
    try {
        mInterstitialController = new InterstitialController(context, mInterstitialListener);
        mInterstitialController.loadAd(responseId, false);
    } catch (AdException e) {
        MoPubLog.log(MoPubLog.AdapterLogEvent.LOAD_FAILED, TAG);
        mLoadListener.onAdLoadFailed(MoPubErrorCode.ADAPTER_CONFIGURATION_ERROR);
    }
}
Also used : InterstitialController(org.prebid.mobile.rendering.bidding.display.InterstitialController) AdException(org.prebid.mobile.rendering.errors.AdException)

Example 4 with InterstitialController

use of org.prebid.mobile.rendering.bidding.display.InterstitialController in project prebid-mobile-android by prebid.

the class PrebidRewardedVideoAdapter method initInterstitialController.

private void initInterstitialController(Context context, String responseId) {
    try {
        mInterstitialController = new InterstitialController(context, mInterstitialListener);
        mInterstitialController.loadAd(responseId, true);
    } catch (AdException e) {
        MoPubLog.log(MoPubLog.AdapterLogEvent.LOAD_FAILED, TAG);
        mLoadListener.onAdLoadFailed(MoPubErrorCode.ADAPTER_CONFIGURATION_ERROR);
    }
}
Also used : InterstitialController(org.prebid.mobile.rendering.bidding.display.InterstitialController) AdException(org.prebid.mobile.rendering.errors.AdException)

Example 5 with InterstitialController

use of org.prebid.mobile.rendering.bidding.display.InterstitialController in project prebid-mobile-android by prebid.

the class InterstitialAdUnitTest method onFailedAndWithWinnerBid_ExecuteInterstitialControllerLoadAd.

@Test
public void onFailedAndWithWinnerBid_ExecuteInterstitialControllerLoadAd() {
    final BidResponse mockBidResponse = mock(BidResponse.class);
    final InterstitialController mockInterstitialController = mock(InterstitialController.class);
    final Bid mockBid = mock(Bid.class);
    final InterstitialEventListener spyEventListener = spy(getEventListener());
    when(mockBidResponse.getWinningBid()).thenReturn(mockBid);
    WhiteBox.setInternalState(mInterstitialAdUnit, "mBidResponse", mockBidResponse);
    WhiteBox.setInternalState(mInterstitialAdUnit, "mInterstitialController", mockInterstitialController);
    spyEventListener.onAdFailed(new AdException(AdException.INTERNAL_ERROR, "Test"));
    verify(spyEventListener, times(1)).onPrebidSdkWin();
    verify(mockInterstitialController, times(1)).loadAd(any(), any());
}
Also used : InterstitialController(org.prebid.mobile.rendering.bidding.display.InterstitialController) BidResponse(org.prebid.mobile.rendering.bidding.data.bid.BidResponse) Bid(org.prebid.mobile.rendering.bidding.data.bid.Bid) InterstitialEventListener(org.prebid.mobile.rendering.bidding.listeners.InterstitialEventListener) AdException(org.prebid.mobile.rendering.errors.AdException) Test(org.junit.Test)

Aggregations

InterstitialController (org.prebid.mobile.rendering.bidding.display.InterstitialController)8 AdException (org.prebid.mobile.rendering.errors.AdException)6 Test (org.junit.Test)4 AdError (com.google.android.gms.ads.AdError)2 Bid (org.prebid.mobile.rendering.bidding.data.bid.Bid)2 BidResponse (org.prebid.mobile.rendering.bidding.data.bid.BidResponse)2 InterstitialControllerListener (org.prebid.mobile.rendering.bidding.interfaces.InterstitialControllerListener)2 Bundle (android.os.Bundle)1 InterstitialEventListener (org.prebid.mobile.rendering.bidding.listeners.InterstitialEventListener)1 RewardedVideoEventListener (org.prebid.mobile.rendering.bidding.listeners.RewardedVideoEventListener)1