Search in sources :

Example 6 with MraidEvent

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

the class MraidControllerTest method createMraidEvent.

private MraidEvent createMraidEvent(String eventType, String helper) {
    MraidEvent event = mock(MraidEvent.class);
    event.mraidAction = eventType;
    event.mraidActionHelper = helper;
    return event;
}
Also used : MraidEvent(org.prebid.mobile.rendering.models.internal.MraidEvent)

Example 7 with MraidEvent

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

the class MraidControllerTest method handleMraidEventWhenPlayVideoEvent_DisplayMraidInInterstitial.

@Test
public void handleMraidEventWhenPlayVideoEvent_DisplayMraidInInterstitial() {
    MraidEvent event = createMraidEvent(JSInterface.ACTION_PLAY_VIDEO, "test");
    callControllerHandler(event);
    // called when displaying interstitial
    verify(mMraidController).initMraidExpand(any(View.class), any(MraidController.DisplayCompletionListener.class), any(MraidEvent.class));
}
Also used : MraidEvent(org.prebid.mobile.rendering.models.internal.MraidEvent) View(android.view.View) Test(org.junit.Test)

Example 8 with MraidEvent

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

the class InterstitialManagerTest method displayPrebidWebViewForMraid_CallDelegateDisplayPrebidWebViewForMRAID.

@Test
public void displayPrebidWebViewForMraid_CallDelegateDisplayPrebidWebViewForMRAID() throws Exception {
    WebViewBanner mockWebView = mock(WebViewBanner.class);
    MraidEvent mockEvent = mock(MraidEvent.class);
    mockEvent.mraidAction = JSInterface.ACTION_EXPAND;
    mockEvent.mraidActionHelper = "test";
    when(mockWebView.getMraidEvent()).thenReturn(mockEvent);
    mSpyInterstitialManager.displayPrebidWebViewForMraid(mockWebView, true);
    verify(mMockMraidDelegate).displayPrebidWebViewForMraid(mockWebView, true, mockEvent);
}
Also used : WebViewBanner(org.prebid.mobile.rendering.views.webview.WebViewBanner) MraidEvent(org.prebid.mobile.rendering.models.internal.MraidEvent) Test(org.junit.Test)

Example 9 with MraidEvent

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

the class BaseJSInterfaceTest method resizeTest.

@Test
public void resizeTest() throws Exception {
    Field field = WhiteBox.field(BaseJSInterface.class, "mMraidEvent");
    mSpyBaseJSInterface.resize();
    MraidEvent event = (MraidEvent) field.get(mSpyBaseJSInterface);
    assertEquals(JSInterface.ACTION_RESIZE, event.mraidAction);
    verify(mMockMraidController).handleMraidEvent(eq(event), eq(mMockCreative), any(WebViewBase.class), any());
}
Also used : Field(java.lang.reflect.Field) 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)

Example 10 with MraidEvent

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

the class BaseJSInterfaceTest method createCalendarEventTest.

@Test
public void createCalendarEventTest() throws Exception {
    Field field = WhiteBox.field(BaseJSInterface.class, "mMraidEvent");
    mSpyBaseJSInterface.createCalendarEvent("test");
    MraidEvent event = (MraidEvent) field.get(mSpyBaseJSInterface);
    assertEquals(JSInterface.ACTION_CREATE_CALENDAR_EVENT, event.mraidAction);
    assertEquals("test", event.mraidActionHelper);
    verify(mMockMraidController).handleMraidEvent(eq(event), eq(mMockCreative), any(WebViewBase.class), any());
}
Also used : Field(java.lang.reflect.Field) 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