use of org.prebid.mobile.rendering.views.webview.WebViewBase in project prebid-mobile-android by prebid.
the class InterstitialManagerTest method addOldViewToBackStackIntControllerNull_ZeroViewStackInteractions.
@Test
public void addOldViewToBackStackIntControllerNull_ZeroViewStackInteractions() throws IllegalAccessException {
WebViewBase mockWebViewBase = mock(WebViewBase.class);
Stack<View> mockViewStack = spy(new Stack<>());
WhiteBox.field(InterstitialManager.class, "mViewStack").set(mSpyInterstitialManager, mockViewStack);
mSpyInterstitialManager.addOldViewToBackStack(mockWebViewBase, null, null);
verifyZeroInteractions(mockViewStack);
}
use of org.prebid.mobile.rendering.views.webview.WebViewBase in project prebid-mobile-android by prebid.
the class MraidControllerTest method delegateDisplayViewInInterstitialAndExpandNotNull_SetExpandDisplayViewAndInitMraidExpanded.
@Test
public void delegateDisplayViewInInterstitialAndExpandNotNull_SetExpandDisplayViewAndInitMraidExpanded() throws IllegalAccessException {
mMraidController = new MraidController(mMockInterstitialManager);
WebViewBase mockWebView = mock(WebViewBase.class);
MraidEvent mockEvent = mock(MraidEvent.class);
MraidExpand mockMraidExpand = mock(MraidExpand.class);
PrebidWebViewBase mockWebViewBase = mock(PrebidWebViewBase.class);
mockEvent.mraidAction = JSInterface.ACTION_EXPAND;
mockEvent.mraidActionHelper = "test";
when(mockMraidExpand.getInterstitialViewController()).thenReturn(mock(AdBaseDialog.class));
when(mockWebView.getPreloadedListener()).thenReturn(mockWebViewBase);
WhiteBox.field(MraidController.class, "mMraidExpand").set(mMraidController, mockMraidExpand);
getMraidDelegate().displayPrebidWebViewForMraid(mockWebView, true, mockEvent);
verify(mockMraidExpand, times(1)).setDisplayView(mockWebView);
verify(mockWebViewBase).initMraidExpanded();
}
use of org.prebid.mobile.rendering.views.webview.WebViewBase in project prebid-mobile-android by prebid.
the class MraidControllerTest method callControllerHandler.
private void callControllerHandler(MraidEvent event) {
final HTMLCreative mockCreative = mock(HTMLCreative.class);
final CreativeModel mockCreativeModel = mock(CreativeModel.class);
final WebViewBase mockOldWebView = mock(WebViewBase.class);
when(mockCreative.getCreativeModel()).thenReturn(mockCreativeModel);
when(mockCreativeModel.getAdConfiguration()).thenReturn(mock(AdConfiguration.class));
when(mockOldWebView.getContext()).thenReturn(mContext);
mMraidController.handleMraidEvent(event, mockCreative, mockOldWebView, mock(PrebidWebViewBase.class));
}
use of org.prebid.mobile.rendering.views.webview.WebViewBase in project prebid-mobile-android by prebid.
the class InterstitialManagerTest method interstitialClosedWithView_NotifyInterstitialDelegate.
@Test
public void interstitialClosedWithView_NotifyInterstitialDelegate() {
WebViewBase mockWebView = mock(WebViewBase.class);
BaseJSInterface mockInterface = mock(BaseJSInterface.class);
when(mockWebView.getMRAIDInterface()).thenReturn(mockInterface);
mSpyInterstitialManager.interstitialClosed(mockWebView);
verify(mMockInterstitialManagerDisplayDelegate, times(1)).interstitialAdClosed();
}
use of org.prebid.mobile.rendering.views.webview.WebViewBase in project prebid-mobile-android by prebid.
the class InterstitialManagerTest method displayViewAsInterstitialSuccess_ShowInterstitialAdView.
@Test
@LooperMode(LooperMode.Mode.PAUSED)
public void displayViewAsInterstitialSuccess_ShowInterstitialAdView() {
VideoCreative mockVideoCreative = mock(VideoCreative.class);
when(mockVideoCreative.isResolved()).thenReturn(true);
BaseJSInterface mockJsInterface = mock(BaseJSInterface.class);
when(mockJsInterface.getJsExecutor()).thenReturn(mock(JsExecutor.class));
WebViewBase mockWebViewBase = mock(WebViewBase.class);
when(mockWebViewBase.getMRAIDInterface()).thenReturn(mockJsInterface);
PrebidWebViewInterstitial mockPrebidWebViewInterstitial = mock(PrebidWebViewInterstitial.class);
when(mockPrebidWebViewInterstitial.getWebView()).thenReturn(mockWebViewBase);
InterstitialView mockInterstitialView = mock(InterstitialView.class);
when(mockInterstitialView.getCreativeView()).thenReturn(mockPrebidWebViewInterstitial);
mSpyInterstitialManager.displayAdViewInInterstitial(mContext, mockInterstitialView);
verify(mMockAdViewDelegate).showInterstitial();
}
Aggregations