Search in sources :

Example 6 with InterstitialManager

use of org.prebid.mobile.rendering.views.interstitial.InterstitialManager in project prebid-mobile-android by prebid.

the class AdExpandedDialogTest method handleCloseClick.

@Test
public void handleCloseClick() throws IllegalAccessException {
    InterstitialManager interstitialManager = mock(InterstitialManager.class);
    Field interstitialManagerField = WhiteBox.field(AdInterstitialDialog.class, "mInterstitialManager");
    interstitialManagerField.set(mAdExpandedDialog, interstitialManager);
    mAdExpandedDialog.handleCloseClick();
    verify(interstitialManager).interstitialClosed(eq(mMockWebViewBase));
}
Also used : Field(java.lang.reflect.Field) InterstitialManager(org.prebid.mobile.rendering.views.interstitial.InterstitialManager) Test(org.junit.Test)

Example 7 with InterstitialManager

use of org.prebid.mobile.rendering.views.interstitial.InterstitialManager in project prebid-mobile-android by prebid.

the class TransactionTest method onSuccessWithCreativeTimeout_TransactionListenerSuccessNotCalled.

@Test
public void onSuccessWithCreativeTimeout_TransactionListenerSuccessNotCalled() throws Exception {
    List<CreativeModel> creativeModels = Arrays.asList(mock(CreativeModel.class), mock(CreativeModel.class));
    Transaction.Listener mockListener = mock(Transaction.Listener.class);
    InterstitialManager mockInterstitialManager = mock(InterstitialManager.class);
    Transaction transaction = Transaction.createTransaction(mMockContext, createModelResult(creativeModels, ""), mockInterstitialManager, mockListener);
    Transaction.CreativeFactoryListener creativeFactoryListener = new Transaction.CreativeFactoryListener(transaction);
    Iterator<CreativeFactory> mockIterator = mock(Iterator.class);
    when(mockIterator.hasNext()).thenReturn(true);
    when(mockIterator.next()).thenReturn(mock(CreativeFactory.class));
    WhiteBox.setInternalState(transaction, "mCreativeFactoryIterator", mockIterator);
    creativeFactoryListener.onSuccess();
    verify(mockListener, never()).onTransactionSuccess(transaction);
    AdException adException = new AdException(AdException.INTERNAL_ERROR, "CreativeFactory Timeout");
    creativeFactoryListener.onFailure(adException);
    verify(mockListener).onTransactionFailure(eq(adException), anyString());
}
Also used : CreativeModel(org.prebid.mobile.rendering.models.CreativeModel) InterstitialManager(org.prebid.mobile.rendering.views.interstitial.InterstitialManager) AdException(org.prebid.mobile.rendering.errors.AdException) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)7 InterstitialManager (org.prebid.mobile.rendering.views.interstitial.InterstitialManager)7 AdException (org.prebid.mobile.rendering.errors.AdException)3 Field (java.lang.reflect.Field)2 CreativeModel (org.prebid.mobile.rendering.models.CreativeModel)2 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 WebView (android.webkit.WebView)1 ArrayList (java.util.ArrayList)1 VideoCreativeViewListener (org.prebid.mobile.rendering.listeners.VideoCreativeViewListener)1 WebViewDelegate (org.prebid.mobile.rendering.listeners.WebViewDelegate)1 MraidEvent (org.prebid.mobile.rendering.models.internal.MraidEvent)1 ExoPlayerView (org.prebid.mobile.rendering.video.ExoPlayerView)1 PrebidWebViewBanner (org.prebid.mobile.rendering.views.webview.PrebidWebViewBanner)1 PrebidWebViewInterstitial (org.prebid.mobile.rendering.views.webview.PrebidWebViewInterstitial)1