use of org.prebid.mobile.rendering.views.webview.mraid.BaseJSInterface in project prebid-mobile-android by prebid.
the class WebViewBaseTest method destroyTest.
@Test
public void destroyTest() throws IllegalAccessException {
BaseJSInterface mockInterface = mock(BaseJSInterface.class);
WhiteBox.field(WebViewBase.class, "mMraidInterface").set(mWebViewBase, mockInterface);
mWebViewBase.destroy();
verify(mockInterface).destroy();
}
use of org.prebid.mobile.rendering.views.webview.mraid.BaseJSInterface in project prebid-mobile-android by prebid.
the class MraidCalendarEventTest method testCreateCalendarEvent.
@Test
public void testCreateCalendarEvent() {
BaseJSInterface mockJs = mock(BaseJSInterface.class);
MraidCalendarEvent event = new MraidCalendarEvent(mockJs);
event.createCalendarEvent(mCalendarParameters);
ShadowActivity shadowActivity = shadowOf(mTestActivity);
Intent startedIntent = shadowActivity.getNextStartedActivity();
assertFalse("somecrap.calendar/event".equals(startedIntent.getType()));
assertEquals("vnd.android.cursor.item/event", startedIntent.getType());
assertFalse("fail.event.type".equals(startedIntent.getType()));
assertEquals("", startedIntent.getExtras().get(CalendarContract.Events.TITLE));
assertTrue(startedIntent.getExtras().get(CalendarContract.Events.DESCRIPTION).equals("mayanApocalypse/End of world"));
}
use of org.prebid.mobile.rendering.views.webview.mraid.BaseJSInterface in project prebid-mobile-android by prebid.
the class MraidOrientationBroadcastReceiver method handleOrientationChange.
@Override
public void handleOrientationChange(int currentRotation) {
super.handleOrientationChange(currentRotation);
BaseJSInterface baseJSInterface = mBaseJSInterfaceWeakReference.get();
if (baseJSInterface == null) {
LogUtil.debug(TAG, "handleOrientationChange failure. BaseJsInterface is null");
return;
}
if (shouldHandleClose()) {
LogUtil.debug(TAG, "Call 'close' action for MRAID Resize after changing rotation for API 19.");
baseJSInterface.close();
}
}
use of org.prebid.mobile.rendering.views.webview.mraid.BaseJSInterface in project prebid-mobile-android by prebid.
the class MraidInternalBrowserAction method performAction.
@Override
public void performAction(Context context, UrlHandler urlHandler, Uri uri) throws ActionNotResolvedException {
BaseJSInterface baseJSInterface = mJSInterfaceWeakReference.get();
if (baseJSInterface == null) {
throw new ActionNotResolvedException("Action can't be handled. BaseJSInterface is null");
}
handleInternalBrowserAction(context, baseJSInterface, uri.toString());
}
use of org.prebid.mobile.rendering.views.webview.mraid.BaseJSInterface in project prebid-mobile-android by prebid.
the class WebViewInterstitial method setMRAIDInterface.
public void setMRAIDInterface() {
BaseJSInterface mraid = new InterstitialJSInterface(getContext(), this, new JsExecutor(this, new Handler(Looper.getMainLooper()), new HandlerQueueManager()));
addJavascriptInterface(mraid, "jsBridge");
LogUtil.debug(TAG, "JS bridge initialized");
setBaseJSInterface(mraid);
}
Aggregations