use of org.prebid.mobile.rendering.models.HTMLCreative in project prebid-mobile-android by prebid.
the class MraidControllerTest method handleMraidEventWhenExpandEventAndHelperEmpty_InitExpand.
@Test
public void handleMraidEventWhenExpandEventAndHelperEmpty_InitExpand() {
MraidEvent event = createMraidEvent(JSInterface.ACTION_EXPAND, null);
HTMLCreative mockCreative = mock(HTMLCreative.class);
WebViewBase mockOldWebView = mock(WebViewBase.class);
when(mockOldWebView.getMraidListener()).thenReturn(mock(MraidEventsManager.MraidListener.class));
when(mockOldWebView.getContext()).thenReturn(mContext);
mMraidController.handleMraidEvent(event, mockCreative, mockOldWebView, mock(PrebidWebViewBase.class));
verify(mMraidController).initMraidExpand(any(View.class), any(MraidController.DisplayCompletionListener.class), any(MraidEvent.class));
}
use of org.prebid.mobile.rendering.models.HTMLCreative in project prebid-mobile-android by prebid.
the class CreativeFactoryTest method testAttemptAuidCreative.
@Test
public void testAttemptAuidCreative() throws Exception {
AdConfiguration adConfiguration = new AdConfiguration();
adConfiguration.setAdUnitIdentifierType(AdConfiguration.AdUnitIdentifierType.BANNER);
Handler mockHandler = mock(Handler.class);
when(mMockModel.getAdConfiguration()).thenReturn(adConfiguration);
when(mMockModel.getName()).thenReturn(HTML_CREATIVE_TAG);
when(mMockModel.getImpressionUrl()).thenReturn("impressionUrl");
when(mMockModel.getClickUrl()).thenReturn("clickUrl");
// Run the creativeFactory
CreativeFactory creativeFactory = new CreativeFactory(mMockContext, mMockModel, mMockListener, mMockOmAdSessionManager, mMockInterstitialManager);
WhiteBox.field(CreativeFactory.class, "mTimeoutHandler").set(creativeFactory, mockHandler);
creativeFactory.start();
AbstractCreative creative = creativeFactory.getCreative();
assertNotNull(creative);
assertTrue(creative instanceof HTMLCreative);
verify(mockHandler).postDelayed(any(Runnable.class), eq(6_000L));
}
use of org.prebid.mobile.rendering.models.HTMLCreative in project prebid-mobile-android by prebid.
the class BaseJSInterface method notifyMraidEventHandler.
private void notifyMraidEventHandler() {
mOrientationBroadcastReceiver.setMraidAction(mMraidEvent.mraidAction);
HTMLCreative htmlCreative = ((PrebidWebViewBase) mAdBaseView.getPreloadedListener()).getCreative();
mAdBaseView.post(new MraidEventHandlerNotifierRunnable(htmlCreative, mAdBaseView, mMraidEvent, mJsExecutor));
}
use of org.prebid.mobile.rendering.models.HTMLCreative in project prebid-mobile-android by prebid.
the class MraidEventHandlerNotifierRunnable method run.
@Override
public void run() {
HTMLCreative htmlCreative = mWeakHtmlCreative.get();
WebViewBase webViewBase = mWeakWebViewBase.get();
if (htmlCreative == null || webViewBase == null) {
LogUtil.debug(TAG, "Unable to pass event to handler. HtmlCreative or webviewBase is null");
return;
}
htmlCreative.handleMRAIDEventsInCreative(mMraidEvent, webViewBase);
final JsExecutor jsExecutor = mWeakJsExecutor.get();
if (jsExecutor == null) {
LogUtil.debug(TAG, "Unable to executeNativeCallComplete(). JsExecutor is null.");
return;
}
jsExecutor.executeNativeCallComplete();
}
Aggregations