use of org.prebid.mobile.rendering.utils.exposure.ViewExposure in project prebid-mobile-android by prebid.
the class JsExecutorTest method whenExecuteExposureChange_EvaluateMraidScript.
@Test
public void whenExecuteExposureChange_EvaluateMraidScript() {
ViewExposure viewExposure = new ViewExposure();
String expectedString = String.format("mraid.onExposureChange('%1$s');", viewExposure.toString());
mSpyJsExecutor.executeExposureChange(viewExposure);
assertEquals(viewExposure.toString(), mMraidVariableContainer.getCurrentExposure());
verify(mSpyJsExecutor).evaluateMraidScript(expectedString);
}
use of org.prebid.mobile.rendering.utils.exposure.ViewExposure in project prebid-mobile-android by prebid.
the class CreativeVisibilityTrackerTest method visibilityRunnable_runWitViewVisibleForLessThanMinDuration_ShouldNotCallOnVisibilityChanged_ImpTrackerFiredFalse_IsVisibilityScheduledTrue.
@Test
public void visibilityRunnable_runWitViewVisibleForLessThanMinDuration_ShouldNotCallOnVisibilityChanged_ImpTrackerFiredFalse_IsVisibilityScheduledTrue() throws Exception {
ViewExposure viewExposure = new ViewExposure(5.0f, null, null);
when(mSpyVisibilityChecker.isVisible(any(View.class))).thenReturn(true);
when(mSpyVisibilityChecker.hasBeenVisible()).thenReturn(false);
when(mSpyVisibilityChecker.hasRequiredTimeElapsed()).thenReturn(false);
when(mSpyVisibilityChecker.checkViewExposure(any(View.class))).thenReturn(viewExposure);
VisibilityTrackerResult result = new VisibilityTrackerResult(NativeEventTracker.EventType.IMPRESSION, viewExposure, true, false);
mCreativeVisibilityTracker.mVisibilityRunnable.run();
verify(mMockVisibilityTrackerListener).onVisibilityChanged(result);
final VisibilityTrackerOption visibilityTrackerOption = mSpyVisibilityChecker.getVisibilityTrackerOption();
assertFalse(visibilityTrackerOption.isImpressionTracked());
assertTrue((Boolean) getFieldValue("mIsVisibilityScheduled"));
}
use of org.prebid.mobile.rendering.utils.exposure.ViewExposure in project prebid-mobile-android by prebid.
the class VisibilityChecker method checkViewExposure.
public ViewExposure checkViewExposure(@Nullable final View view) {
if (view == null) {
return null;
}
ViewExposure exposure = mViewExposureChecker.exposure(view);
LogUtil.debug(TAG, exposure != null ? exposure.toString() : "null exposure");
return exposure;
}
Aggregations