use of org.prebid.mobile.rendering.models.internal.MraidVariableContainer in project prebid-mobile-android by prebid.
the class MraidControllerTest method handleMraidEventWhenResizeEvent_CallResize.
@Test
public void handleMraidEventWhenResizeEvent_CallResize() throws Exception {
BaseJSInterface mockJsInterface = mock(BaseJSInterface.class);
MraidVariableContainer container = new MraidVariableContainer();
container.setCurrentState(JSInterface.STATE_LOADING);
when(mockJsInterface.getMraidVariableContainer()).thenReturn(container);
WebViewBase mockOldWebView = mock(WebViewBase.class);
when(mockOldWebView.getContext()).thenReturn(mContext);
when(mockOldWebView.getMRAIDInterface()).thenReturn(mockJsInterface);
mMraidController.handleMraidEvent(createMraidEvent(JSInterface.ACTION_RESIZE, null), mock(HTMLCreative.class), mockOldWebView, mock(PrebidWebViewBase.class));
assertNotNull(WhiteBox.getInternalState(mMraidController, "mMraidResize"));
}
use of org.prebid.mobile.rendering.models.internal.MraidVariableContainer in project prebid-mobile-android by prebid.
the class PrebidWebViewBanner method handleExpandPropertiesResult.
private void handleExpandPropertiesResult(String expandProperties) {
JSONObject jsonExpandProperties;
WebViewBase currentWebView = (mWebView != null) ? mWebView : mMraidWebView;
final MraidVariableContainer mraidVariableContainer = currentWebView.getMRAIDInterface().getMraidVariableContainer();
mraidVariableContainer.setExpandProperties(expandProperties);
try {
jsonExpandProperties = new JSONObject(expandProperties);
mDefinedWidthForExpand = jsonExpandProperties.optInt("width", 0);
mDefinedHeightForExpand = jsonExpandProperties.optInt("height", 0);
if (mInterstitialManager.getInterstitialDisplayProperties() != null) {
mInterstitialManager.getInterstitialDisplayProperties().expandWidth = mDefinedWidthForExpand;
mInterstitialManager.getInterstitialDisplayProperties().expandHeight = mDefinedHeightForExpand;
}
} catch (Exception e) {
LogUtil.error(TAG, "handleExpandPropertiesResult: Failed. Reason: " + Log.getStackTraceString(e));
}
}
Aggregations