Search in sources :

Example 1 with CreativeViewListener

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

the class HTMLCreative method interstitialDialogShown.

@Override
public void interstitialDialogShown(ViewGroup rootViewGroup) {
    CreativeViewListener creativeViewListener = getCreativeViewListener();
    if (creativeViewListener == null) {
        LogUtil.debug(TAG, "interstitialDialogShown(): Failed to notify creativeViewListener. creativeViewListener is null.");
        return;
    }
    creativeViewListener.creativeInterstitialDialogShown(rootViewGroup);
}
Also used : CreativeViewListener(org.prebid.mobile.rendering.listeners.CreativeViewListener)

Example 2 with CreativeViewListener

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

the class VideoCreativeTest method whenOnCallToAction_CreativeViewListenerCreativeWasClicked.

@Test
public void whenOnCallToAction_CreativeViewListenerCreativeWasClicked() {
    CreativeViewListener mockListener = mock(CreativeViewListener.class);
    when(mMockVideoCreativeView.getCallToActionUrl()).thenReturn("url");
    mVideoCreative.setCreativeViewListener(mockListener);
    mVideoCreative.onEvent(VideoAdEvent.Event.AD_CLICK);
    verify(mockListener).creativeWasClicked(any(AbstractCreative.class), eq("url"));
}
Also used : AbstractCreative(org.prebid.mobile.rendering.models.AbstractCreative) CreativeViewListener(org.prebid.mobile.rendering.listeners.CreativeViewListener) Test(org.junit.Test)

Example 3 with CreativeViewListener

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

the class MraidControllerTest method handleMraidEventWhenUnloadEvent_CallCreativeCompleteAndClose.

@Test
public void handleMraidEventWhenUnloadEvent_CallCreativeCompleteAndClose() {
    HTMLCreative mockCreative = mock(HTMLCreative.class);
    CreativeViewListener mockListener = mock(CreativeViewListener.class);
    when(mockCreative.getCreativeViewListener()).thenReturn(mockListener);
    mMraidController.handleMraidEvent(createMraidEvent(JSInterface.ACTION_UNLOAD, null), mockCreative, mock(WebViewBase.class), mock(PrebidWebViewBase.class));
    verify(mMockInterstitialManager).interstitialClosed(any(View.class));
    verify(mockListener).creativeDidComplete(mockCreative);
}
Also used : PrebidWebViewBase(org.prebid.mobile.rendering.views.webview.PrebidWebViewBase) WebViewBase(org.prebid.mobile.rendering.views.webview.WebViewBase) PrebidWebViewBase(org.prebid.mobile.rendering.views.webview.PrebidWebViewBase) CreativeViewListener(org.prebid.mobile.rendering.listeners.CreativeViewListener) View(android.view.View) HTMLCreative(org.prebid.mobile.rendering.models.HTMLCreative) Test(org.junit.Test)

Example 4 with CreativeViewListener

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

the class HTMLCreativeTest method creativeViewListenerEventsTest.

@Test
public void creativeViewListenerEventsTest() throws AdException {
    CreativeViewListener mockCreativeViewListener = mock(CreativeViewListener.class);
    mHtmlCreative.setCreativeViewListener(mockCreativeViewListener);
    mHtmlCreative.interstitialAdClosed();
    verify(mockCreativeViewListener).creativeInterstitialDidClose(mHtmlCreative);
    mHtmlCreative.mraidAdExpanded();
    verify(mockCreativeViewListener).creativeDidExpand(mHtmlCreative);
    mHtmlCreative.mraidAdCollapsed();
    verify(mockCreativeViewListener).creativeDidCollapse(mHtmlCreative);
}
Also used : CreativeViewListener(org.prebid.mobile.rendering.listeners.CreativeViewListener) Test(org.junit.Test)

Example 5 with CreativeViewListener

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

the class HTMLCreativeTest method prebidWebViewDelegateEventTest.

@Test
public void prebidWebViewDelegateEventTest() throws Exception {
    // External link
    PrebidWebViewBase mockPrebidWebViewBase = mock(PrebidWebViewBase.class);
    Mockito.doNothing().when(mockPrebidWebViewBase).handleOpen(anyString());
    when(mockPrebidWebViewBase.post(any(Runnable.class))).thenReturn(anyBoolean());
    mHtmlCreative.setCreativeView(mockPrebidWebViewBase);
    mHtmlCreative.webViewShouldOpenExternalLink("foo");
    verify(mockPrebidWebViewBase).handleOpen(anyString());
    // MRAID link
    CreativeViewListener mockCreativeViewListener = mock(CreativeViewListener.class);
    mHtmlCreative.setCreativeViewListener(mockCreativeViewListener);
    mHtmlCreative.webViewShouldOpenMRAIDLink("foo");
    verify(mockCreativeViewListener).creativeWasClicked(any(HTMLCreative.class), anyString());
    verify(mockPrebidWebViewBase).post(any(Runnable.class));
}
Also used : PrebidWebViewBase(org.prebid.mobile.rendering.views.webview.PrebidWebViewBase) CreativeViewListener(org.prebid.mobile.rendering.listeners.CreativeViewListener) Test(org.junit.Test)

Aggregations

CreativeViewListener (org.prebid.mobile.rendering.listeners.CreativeViewListener)7 Test (org.junit.Test)6 AbstractCreative (org.prebid.mobile.rendering.models.AbstractCreative)2 PrebidWebViewBase (org.prebid.mobile.rendering.views.webview.PrebidWebViewBase)2 View (android.view.View)1 HTMLCreative (org.prebid.mobile.rendering.models.HTMLCreative)1 WebViewBase (org.prebid.mobile.rendering.views.webview.WebViewBase)1