Search in sources :

Example 16 with MraidEvent

use of org.prebid.mobile.rendering.models.internal.MraidEvent 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)

Example 17 with MraidEvent

use of org.prebid.mobile.rendering.models.internal.MraidEvent in project prebid-mobile-android by prebid.

the class MraidControllerTest method handleMraidEventWhenExpandEventAndHelperEmpty_InitExpand.

@Test
public void handleMraidEventWhenExpandEventAndHelperEmpty_InitExpand() {
    MraidEvent event = createMraidEvent(JSInterface.ACTION_EXPAND, null);
    HTMLCreative mockCreative = mock(HTMLCreative.class);
    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));
    verify(mMraidController).initMraidExpand(any(View.class), any(MraidController.DisplayCompletionListener.class), any(MraidEvent.class));
}
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) View(android.view.View) HTMLCreative(org.prebid.mobile.rendering.models.HTMLCreative) Test(org.junit.Test)

Example 18 with MraidEvent

use of org.prebid.mobile.rendering.models.internal.MraidEvent in project prebid-mobile-android by prebid.

the class MraidControllerTest method delegateDisplayViewInInterstitialAndExpandNull_InitExpand.

@Test
public void delegateDisplayViewInInterstitialAndExpandNull_InitExpand() throws Exception {
    mMraidController = new MraidController(mMockInterstitialManager);
    MraidEvent mockEvent = mock(MraidEvent.class);
    mockEvent.mraidAction = JSInterface.ACTION_EXPAND;
    mockEvent.mraidActionHelper = "test";
    InterstitialManagerMraidDelegate delegate = getMraidDelegate();
    delegate.displayViewInInterstitial(mock(WebViewBase.class), true, mockEvent, mock(MraidController.DisplayCompletionListener.class));
    assertNotNull(WhiteBox.getInternalState(mMraidController, "mMraidExpand"));
}
Also used : WebViewBase(org.prebid.mobile.rendering.views.webview.WebViewBase) PrebidWebViewBase(org.prebid.mobile.rendering.views.webview.PrebidWebViewBase) MraidEvent(org.prebid.mobile.rendering.models.internal.MraidEvent) Test(org.junit.Test)

Aggregations

MraidEvent (org.prebid.mobile.rendering.models.internal.MraidEvent)18 Test (org.junit.Test)17 PrebidWebViewBase (org.prebid.mobile.rendering.views.webview.PrebidWebViewBase)14 WebViewBase (org.prebid.mobile.rendering.views.webview.WebViewBase)14 Field (java.lang.reflect.Field)9 View (android.view.View)2 HTMLCreative (org.prebid.mobile.rendering.models.HTMLCreative)2 WebViewBanner (org.prebid.mobile.rendering.views.webview.WebViewBanner)2 ViewGroup (android.view.ViewGroup)1 AdException (org.prebid.mobile.rendering.errors.AdException)1 AdBaseDialog (org.prebid.mobile.rendering.interstitial.AdBaseDialog)1 WebViewDelegate (org.prebid.mobile.rendering.listeners.WebViewDelegate)1 InterstitialManager (org.prebid.mobile.rendering.views.interstitial.InterstitialManager)1