Search in sources :

Example 1 with BannerEventListener

use of org.prebid.mobile.rendering.bidding.listeners.BannerEventListener in project prebid-mobile-android by prebid.

the class BannerViewTest method onFailedAndWithWinnerBid_AdRequestStatusIsFinishedNotifyPrebidSdkWin.

@Test
public void onFailedAndWithWinnerBid_AdRequestStatusIsFinishedNotifyPrebidSdkWin() {
    changePrimaryAdServerRequestStatus(true);
    final BidResponse mockBidResponse = mock(BidResponse.class);
    final Bid mockBid = mock(Bid.class);
    final BannerEventListener spyEventListener = spy(getBannerEventListener());
    when(mockBidResponse.getWinningBid()).thenReturn(mockBid);
    when(mockBidResponse.getWinningBidWidthHeightPairDips(any())).thenReturn(Pair.create(0, 0));
    mBannerView.setBidResponse(mockBidResponse);
    spyEventListener.onAdFailed(new AdException(AdException.INTERNAL_ERROR, "Test"));
    assertFalse(mBannerView.isPrimaryAdServerRequestInProgress());
    verify(spyEventListener, times(1)).onPrebidSdkWin();
}
Also used : BannerEventListener(org.prebid.mobile.rendering.bidding.listeners.BannerEventListener) BidResponse(org.prebid.mobile.rendering.bidding.data.bid.BidResponse) Bid(org.prebid.mobile.rendering.bidding.data.bid.Bid) AdException(org.prebid.mobile.rendering.errors.AdException) Test(org.junit.Test)

Example 2 with BannerEventListener

use of org.prebid.mobile.rendering.bidding.listeners.BannerEventListener in project prebid-mobile-android by prebid.

the class BannerViewTest method onPrebidSdkWinAndWinnerBidIsNull_AdRequestStatusIsFinishedNotifyErrorListener.

// endregion ======================= BidRequestListener tests
// region ================= BannerEventListener tests
@Test
public void onPrebidSdkWinAndWinnerBidIsNull_AdRequestStatusIsFinishedNotifyErrorListener() {
    changePrimaryAdServerRequestStatus(true);
    final BannerEventListener bannerEventListener = getBannerEventListener();
    mBannerView.setBidResponse(null);
    bannerEventListener.onPrebidSdkWin();
    verify(mMockBannerListener, times(1)).onAdFailed(eq(mBannerView), any(AdException.class));
    assertFalse(mBannerView.isPrimaryAdServerRequestInProgress());
}
Also used : BannerEventListener(org.prebid.mobile.rendering.bidding.listeners.BannerEventListener) AdException(org.prebid.mobile.rendering.errors.AdException) Test(org.junit.Test)

Example 3 with BannerEventListener

use of org.prebid.mobile.rendering.bidding.listeners.BannerEventListener in project prebid-mobile-android by prebid.

the class BannerViewTest method onAdOpened_NotifyAdClickedListener.

@Test
public void onAdOpened_NotifyAdClickedListener() {
    final BannerEventListener bannerEventListener = getBannerEventListener();
    bannerEventListener.onAdClicked();
    verify(mMockBannerListener, times(1)).onAdClicked(mBannerView);
}
Also used : BannerEventListener(org.prebid.mobile.rendering.bidding.listeners.BannerEventListener) Test(org.junit.Test)

Example 4 with BannerEventListener

use of org.prebid.mobile.rendering.bidding.listeners.BannerEventListener in project prebid-mobile-android by prebid.

the class BannerViewTest method onAdClosed_NotifyAdClosedListener.

@Test
public void onAdClosed_NotifyAdClosedListener() {
    final BannerEventListener bannerEventListener = getBannerEventListener();
    bannerEventListener.onAdClosed();
    verify(mMockBannerListener, times(1)).onAdClosed(mBannerView);
}
Also used : BannerEventListener(org.prebid.mobile.rendering.bidding.listeners.BannerEventListener) Test(org.junit.Test)

Example 5 with BannerEventListener

use of org.prebid.mobile.rendering.bidding.listeners.BannerEventListener in project prebid-mobile-android by prebid.

the class BannerViewTest method onFailedAndNoWinnerBid_AdRequestStatusIsFinishedNotifyErrorListener.

@Test
public void onFailedAndNoWinnerBid_AdRequestStatusIsFinishedNotifyErrorListener() {
    changePrimaryAdServerRequestStatus(true);
    mBannerView.setBidResponse(null);
    final AdException exception = new AdException(AdException.INTERNAL_ERROR, "Test");
    final BannerEventListener bannerEventListener = getBannerEventListener();
    bannerEventListener.onAdFailed(exception);
    verify(mMockBannerListener, times(1)).onAdFailed(mBannerView, exception);
}
Also used : BannerEventListener(org.prebid.mobile.rendering.bidding.listeners.BannerEventListener) AdException(org.prebid.mobile.rendering.errors.AdException) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)7 BannerEventListener (org.prebid.mobile.rendering.bidding.listeners.BannerEventListener)7 AdException (org.prebid.mobile.rendering.errors.AdException)3 Bid (org.prebid.mobile.rendering.bidding.data.bid.Bid)2 BidResponse (org.prebid.mobile.rendering.bidding.data.bid.BidResponse)2 View (android.view.View)1 DisplayView (org.prebid.mobile.rendering.bidding.display.DisplayView)1