use of org.prebid.mobile.rendering.models.internal.MraidEvent in project prebid-mobile-android by prebid.
the class BaseJSInterfaceTest method storePictureTest.
@Test
public void storePictureTest() throws Exception {
Field field = WhiteBox.field(BaseJSInterface.class, "mMraidEvent");
mSpyBaseJSInterface.storePicture("test");
MraidEvent event = (MraidEvent) field.get(mSpyBaseJSInterface);
assertEquals(JSInterface.ACTION_STORE_PICTURE, event.mraidAction);
assertEquals("test", event.mraidActionHelper);
verify(mMockMraidController).handleMraidEvent(eq(event), eq(mMockCreative), any(WebViewBase.class), any());
}
use of org.prebid.mobile.rendering.models.internal.MraidEvent in project prebid-mobile-android by prebid.
the class BaseJSInterfaceTest method openTest.
@Test
public void openTest() throws Exception {
Field field = WhiteBox.field(BaseJSInterface.class, "mMraidEvent");
mSpyBaseJSInterface.open("test");
MraidEvent event = (MraidEvent) field.get(mSpyBaseJSInterface);
verify(mMockWebViewBase, times(1)).sendClickCallBack(anyString());
assertEquals(JSInterface.ACTION_OPEN, event.mraidAction);
assertEquals("test", event.mraidActionHelper);
verify(mMockMraidController).handleMraidEvent(eq(event), eq(mMockCreative), any(WebViewBase.class), any());
}
use of org.prebid.mobile.rendering.models.internal.MraidEvent in project prebid-mobile-android by prebid.
the class BaseJSInterfaceTest method closeTest.
@Test
public void closeTest() throws Exception {
Field field = WhiteBox.field(BaseJSInterface.class, "mMraidEvent");
mSpyBaseJSInterface.close();
MraidEvent event = (MraidEvent) field.get(mSpyBaseJSInterface);
assertEquals(JSInterface.ACTION_CLOSE, event.mraidAction);
verify(mMockMraidController).handleMraidEvent(eq(event), eq(mMockCreative), any(WebViewBase.class), any());
}
use of org.prebid.mobile.rendering.models.internal.MraidEvent in project prebid-mobile-android by prebid.
the class BaseJSInterfaceTest method playVideoTest.
@Test
public void playVideoTest() throws Exception {
Field field = WhiteBox.field(BaseJSInterface.class, "mMraidEvent");
mSpyBaseJSInterface.playVideo("test");
MraidEvent event = (MraidEvent) field.get(mSpyBaseJSInterface);
assertEquals(JSInterface.ACTION_PLAY_VIDEO, event.mraidAction);
assertEquals("test", event.mraidActionHelper);
verify(mMockMraidController).handleMraidEvent(eq(event), eq(mMockCreative), any(WebViewBase.class), any());
}
use of org.prebid.mobile.rendering.models.internal.MraidEvent 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();
}
Aggregations