Search in sources :

Example 6 with WebViewBase

use of org.prebid.mobile.rendering.views.webview.WebViewBase in project prebid-mobile-android by prebid.

the class InterstitialManagerTest method addOldViewToBackStackValidIntController_PushDisplayViewToStack.

@Test
public void addOldViewToBackStackValidIntController_PushDisplayViewToStack() throws IllegalAccessException {
    WebViewBase mockWebViewBase = mock(WebViewBase.class);
    Stack<View> mockViewStack = spy(new Stack<>());
    AdBaseDialog mockInterstitialViewController = mock(AdBaseDialog.class);
    View mockDisplayView = mock(View.class);
    WhiteBox.field(InterstitialManager.class, "mViewStack").set(mSpyInterstitialManager, mockViewStack);
    when(mockInterstitialViewController.getDisplayView()).thenReturn(mockDisplayView);
    mSpyInterstitialManager.addOldViewToBackStack(mockWebViewBase, "test", mockInterstitialViewController);
    verify(mockViewStack).push(mockDisplayView);
}
Also used : WebViewBase(org.prebid.mobile.rendering.views.webview.WebViewBase) AdBaseDialog(org.prebid.mobile.rendering.interstitial.AdBaseDialog) InterstitialView(org.prebid.mobile.rendering.bidding.display.InterstitialView) View(android.view.View) VideoView(org.prebid.mobile.rendering.bidding.display.VideoView) Test(org.junit.Test)

Example 7 with WebViewBase

use of org.prebid.mobile.rendering.views.webview.WebViewBase 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();
}
Also used : BaseJSInterface(org.prebid.mobile.rendering.views.webview.mraid.BaseJSInterface) PrebidWebViewBase(org.prebid.mobile.rendering.views.webview.PrebidWebViewBase) WebViewBase(org.prebid.mobile.rendering.views.webview.WebViewBase) PrebidWebViewBase(org.prebid.mobile.rendering.views.webview.PrebidWebViewBase) Test(org.junit.Test)

Example 8 with WebViewBase

use of org.prebid.mobile.rendering.views.webview.WebViewBase in project prebid-mobile-android by prebid.

the class InterstitialManager method showInterstitialDialog.

private void showInterstitialDialog(Context context, InterstitialView interstitialView) {
    WebViewBase webViewBase = ((PrebidWebViewInterstitial) interstitialView.getCreativeView()).getWebView();
    webViewBase.setId(INTERSTITIAL_WEBVIEW_ID);
    mInterstitialDialog = new AdInterstitialDialog(context, webViewBase, interstitialView, this);
    mInterstitialDialog.show();
}
Also used : PrebidWebViewInterstitial(org.prebid.mobile.rendering.views.webview.PrebidWebViewInterstitial) WebViewBase(org.prebid.mobile.rendering.views.webview.WebViewBase) AdInterstitialDialog(org.prebid.mobile.rendering.interstitial.AdInterstitialDialog)

Example 9 with WebViewBase

use of org.prebid.mobile.rendering.views.webview.WebViewBase in project prebid-mobile-android by prebid.

the class MraidControllerTest method handleMraidEventWhenExpandEventAndHelperEmpty_RunTwoPartRunnable.

@Test
public void handleMraidEventWhenExpandEventAndHelperEmpty_RunTwoPartRunnable() {
    HTMLCreative mockCreative = mock(HTMLCreative.class);
    MraidEvent event = createMraidEvent(JSInterface.ACTION_EXPAND, "twoPart");
    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));
    ShadowLooper.runUiThreadTasks();
    verify(mMraidController, times(1)).expand(any(WebViewBase.class), any(PrebidWebViewBase.class), eq(event));
}
Also used : PrebidWebViewBase(org.prebid.mobile.rendering.views.webview.PrebidWebViewBase) WebViewBase(org.prebid.mobile.rendering.views.webview.WebViewBase) PrebidWebViewBase(org.prebid.mobile.rendering.views.webview.PrebidWebViewBase) MraidEvent(org.prebid.mobile.rendering.models.internal.MraidEvent) HTMLCreative(org.prebid.mobile.rendering.models.HTMLCreative) Test(org.junit.Test)

Example 10 with WebViewBase

use of org.prebid.mobile.rendering.views.webview.WebViewBase in project prebid-mobile-android by prebid.

the class MraidControllerTest method expandWhenHelperNotEmpty_NewWebViewSetEvent.

@Test
public void expandWhenHelperNotEmpty_NewWebViewSetEvent() {
    WebViewBase mockOldWebView = mock(WebViewBase.class);
    PrebidWebViewBase mockNewWebView = mock(PrebidWebViewBase.class);
    MraidEvent event = createMraidEvent(JSInterface.ACTION_EXPAND, "twoPart");
    WebViewBanner mockBanner = mock(WebViewBanner.class);
    when(mockNewWebView.getMraidWebView()).thenReturn(mockBanner);
    when(mockOldWebView.getMraidListener()).thenReturn(mock(MraidEventsManager.MraidListener.class));
    mMraidController.expand(mockOldWebView, mockNewWebView, event);
    verify(mockNewWebView, times(1)).getMraidWebView();
    verify(mockBanner).setMraidEvent(eq(event));
}
Also used : PrebidWebViewBase(org.prebid.mobile.rendering.views.webview.PrebidWebViewBase) WebViewBase(org.prebid.mobile.rendering.views.webview.WebViewBase) PrebidWebViewBase(org.prebid.mobile.rendering.views.webview.PrebidWebViewBase) MraidEvent(org.prebid.mobile.rendering.models.internal.MraidEvent) WebViewBanner(org.prebid.mobile.rendering.views.webview.WebViewBanner) Test(org.junit.Test)

Aggregations

WebViewBase (org.prebid.mobile.rendering.views.webview.WebViewBase)16 Test (org.junit.Test)10 PrebidWebViewBase (org.prebid.mobile.rendering.views.webview.PrebidWebViewBase)10 HTMLCreative (org.prebid.mobile.rendering.models.HTMLCreative)5 MraidEvent (org.prebid.mobile.rendering.models.internal.MraidEvent)4 BaseJSInterface (org.prebid.mobile.rendering.views.webview.mraid.BaseJSInterface)4 View (android.view.View)3 InterstitialView (org.prebid.mobile.rendering.bidding.display.InterstitialView)3 Handler (android.os.Handler)2 VideoView (org.prebid.mobile.rendering.bidding.display.VideoView)2 AdBaseDialog (org.prebid.mobile.rendering.interstitial.AdBaseDialog)2 PrebidWebViewInterstitial (org.prebid.mobile.rendering.views.webview.PrebidWebViewInterstitial)2 WebViewBanner (org.prebid.mobile.rendering.views.webview.WebViewBanner)2 JsExecutor (org.prebid.mobile.rendering.views.webview.mraid.JsExecutor)2 Context (android.content.Context)1 VisibleForTesting (androidx.annotation.VisibleForTesting)1 ContentObject (org.prebid.mobile.ContentObject)1 AdException (org.prebid.mobile.rendering.errors.AdException)1 AdInterstitialDialog (org.prebid.mobile.rendering.interstitial.AdInterstitialDialog)1 AdConfiguration (org.prebid.mobile.rendering.models.AdConfiguration)1