use of com.onesignal.MockOSTimeImpl in project OneSignal-Android-SDK by OneSignal.
the class InAppMessagingUnitTests method testBuiltMessageRedisplayDelay.
@Test
public void testBuiltMessageRedisplayDelay() throws JSONException {
MockOSTimeImpl time = new MockOSTimeImpl();
OneSignal_setTime(time);
OSTestInAppMessageInternal message = InAppMessagingHelpers.buildTestMessageWitRedisplay(LIMIT, DELAY);
assertTrue(message.getRedisplayStats().isDelayTimeSatisfied());
message.getRedisplayStats().setLastDisplayTimeToCurrent(time);
time.advanceSystemTimeBy(DELAY);
assertTrue(message.getRedisplayStats().isDelayTimeSatisfied());
message.getRedisplayStats().setLastDisplayTimeToCurrent(time);
time.advanceSystemTimeBy(DELAY - 1);
assertFalse(message.getRedisplayStats().isDelayTimeSatisfied());
}
use of com.onesignal.MockOSTimeImpl in project OneSignal-Android-SDK by OneSignal.
the class LocationIntegrationTests method beforeEachTest.
@Before
public void beforeEachTest() throws Exception {
blankActivityController = Robolectric.buildActivity(BlankActivity.class).create();
blankActivity = blankActivityController.get();
time = new MockOSTimeImpl();
trackerFactory = new OSTrackerFactory(new MockOSSharedPreferences(), new MockOSLog(), time);
sessionManager = new MockSessionManager(OneSignal_getSessionListener(), trackerFactory, new MockOSLog());
dbHelper = new MockOneSignalDBHelper(ApplicationProvider.getApplicationContext());
TestHelpers.setupTestWorkManager(blankActivity);
cleanUp();
OneSignal_setTime(time);
}
use of com.onesignal.MockOSTimeImpl in project OneSignal-Android-SDK by OneSignal.
the class HMSDataMessageReceivedIntegrationTestsRunner method beforeEachTest.
@Before
public void beforeEachTest() throws Exception {
TestHelpers.beforeTestInitAndCleanup();
ShadowOSUtils.supportsHMS(true);
time = new MockOSTimeImpl();
OneSignal_setTime(time);
blankActivityController = Robolectric.buildActivity(BlankActivity.class).create();
blankActivity = blankActivityController.get();
}
use of com.onesignal.MockOSTimeImpl in project OneSignal-Android-SDK by OneSignal.
the class MainOneSignalClassRunner method beforeEachTest.
@Before
public void beforeEachTest() throws Exception {
blankActivityController = Robolectric.buildActivity(BlankActivity.class).create();
blankActivity = blankActivityController.get();
time = new MockOSTimeImpl();
trackerFactory = new OSTrackerFactory(new MockOSSharedPreferences(), new MockOSLog(), time);
sessionManager = new MockSessionManager(OneSignal_getSessionListener(), trackerFactory, new MockOSLog());
dbHelper = new MockOneSignalDBHelper(ApplicationProvider.getApplicationContext());
TestHelpers.setupTestWorkManager(blankActivity);
cleanUp();
OneSignal_setTime(time);
}
use of com.onesignal.MockOSTimeImpl in project OneSignal-Android-SDK by OneSignal.
the class TrackerUnitTests method beforeEachTest.
// Before each test
@Before
public void beforeEachTest() throws Exception {
MockOSLog logger = new MockOSLog();
MockOSTimeImpl time = new MockOSTimeImpl();
MockOSSharedPreferences preferences = new MockOSSharedPreferences();
trackerFactory = new OSTrackerFactory(preferences, logger, time);
}
Aggregations