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);
}
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"));
}
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);
}
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);
}
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));
}
Aggregations