use of org.prebid.mobile.rendering.views.webview.mraid.BaseJSInterface 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.mraid.BaseJSInterface 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();
}
use of org.prebid.mobile.rendering.views.webview.mraid.BaseJSInterface in project prebid-mobile-android by prebid.
the class WebViewBaseTest method startLoadingAssetsTest.
@Test
public void startLoadingAssetsTest() throws IllegalAccessException {
BaseJSInterface mockInterface = mock(BaseJSInterface.class);
WhiteBox.field(WebViewBase.class, "mMraidInterface").set(mWebViewBase, mockInterface);
mWebViewBase.startLoadingAssets();
verify(mockInterface).loading();
}
use of org.prebid.mobile.rendering.views.webview.mraid.BaseJSInterface in project prebid-mobile-android by prebid.
the class WebViewBaseTest method adAssetsLoadedTest.
@Test
public void adAssetsLoadedTest() {
BaseJSInterface mockBaseJsInterface = mock(BaseJSInterface.class);
mWebViewBase.setBaseJSInterface(mockBaseJsInterface);
mWebViewBase.mIsMRAID = false;
mWebViewBase.adAssetsLoaded();
verify(mockBaseJsInterface, times(0)).prepareAndSendReady();
verify(mMockPreloadListener, times(1)).preloaded(eq(mWebViewBase));
mWebViewBase.mIsMRAID = true;
mWebViewBase.adAssetsLoaded();
verify(mockBaseJsInterface, times(1)).prepareAndSendReady();
verify(mMockPreloadListener, times(2)).preloaded(eq(mWebViewBase));
}
use of org.prebid.mobile.rendering.views.webview.mraid.BaseJSInterface in project prebid-mobile-android by prebid.
the class HTMLCreativeTest method adSessionSuccessInitializationTest.
@Test
public void adSessionSuccessInitializationTest() throws Exception {
PrebidWebViewBase prebidWebView = new PrebidWebViewBase(mContext, mMockInterstitialManager);
WebViewBase mockWebViewBase = mock(WebViewBase.class);
BaseJSInterface baseJSInterface = mock(BaseJSInterface.class);
when(mockWebViewBase.getMRAIDInterface()).thenReturn(baseJSInterface);
WhiteBox.setInternalState(prebidWebView, "mWebView", mockWebViewBase);
mHtmlCreative.setCreativeView(prebidWebView);
mHtmlCreative.setCreativeView(prebidWebView);
HTMLCreative spyHtmlCreative = spy(mHtmlCreative);
spyHtmlCreative.display();
}
Aggregations