Search in sources :

Example 1 with CreativeResolutionListener

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

the class HTMLCreativeTest method webViewFailedToLoadTest.

@Test
public void webViewFailedToLoadTest() throws Exception {
    CreativeResolutionListener mockResolutionListener = mock(CreativeResolutionListener.class);
    mHtmlCreative.setResolutionListener(mockResolutionListener);
    // Resolved
    WhiteBox.field(HTMLCreative.class, "mResolved").set(mHtmlCreative, true);
    mHtmlCreative.webViewFailedToLoad(new AdException("foo", "bar"));
    verify(mockResolutionListener, never()).creativeFailed(any(AdException.class));
    // Not resolved
    WhiteBox.field(HTMLCreative.class, "mResolved").set(mHtmlCreative, false);
    mHtmlCreative.webViewFailedToLoad(new AdException("foo", "bar"));
    verify(mockResolutionListener).creativeFailed(any(AdException.class));
}
Also used : CreativeResolutionListener(org.prebid.mobile.rendering.listeners.CreativeResolutionListener) AdException(org.prebid.mobile.rendering.errors.AdException) Test(org.junit.Test)

Example 2 with CreativeResolutionListener

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

the class HTMLCreativeTest method webViewReadyToDisplayTest.

@Test
public void webViewReadyToDisplayTest() throws Exception {
    CreativeResolutionListener mockResolutionListener = mock(CreativeResolutionListener.class);
    mHtmlCreative.setResolutionListener(mockResolutionListener);
    // Resolved
    WhiteBox.field(HTMLCreative.class, "mResolved").set(mHtmlCreative, true);
    mHtmlCreative.webViewReadyToDisplay();
    verify(mockResolutionListener, never()).creativeReady(any(AbstractCreative.class));
    // Not resolved
    WhiteBox.field(HTMLCreative.class, "mResolved").set(mHtmlCreative, false);
    mHtmlCreative.webViewReadyToDisplay();
    verify(mockResolutionListener).creativeReady(any(AbstractCreative.class));
}
Also used : CreativeResolutionListener(org.prebid.mobile.rendering.listeners.CreativeResolutionListener) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 CreativeResolutionListener (org.prebid.mobile.rendering.listeners.CreativeResolutionListener)2 AdException (org.prebid.mobile.rendering.errors.AdException)1