use of com.onesignal.MockOSTimeImpl in project OneSignal-Android-SDK by OneSignal.
the class OneSignalInitializationIntegrationTestsRunner method beforeEachTest.
@Before
public void beforeEachTest() throws Exception {
TestHelpers.beforeTestInitAndCleanup();
setRemoteParamsGetHtmlResponse();
blankActivityController = Robolectric.buildActivity(BlankActivity.class).create();
time = new MockOSTimeImpl();
OneSignal_setTime(time);
}
use of com.onesignal.MockOSTimeImpl in project OneSignal-Android-SDK by OneSignal.
the class OutcomeEventIntegrationTests method beforeEachTest.
@Before
public void beforeEachTest() throws Exception {
blankActivityController = Robolectric.buildActivity(BlankActivity.class).create();
blankActivity = blankActivityController.get();
time = new MockOSTimeImpl();
dbHelper = new MockOneSignalDBHelper(ApplicationProvider.getApplicationContext());
preferences = new OneSignalPackagePrivateHelper.OSSharedPreferencesWrapper();
trackerFactory = new OSTrackerFactory(preferences, logger, time);
sessionManager = new MockSessionManager(sessionListener, trackerFactory, logger);
cleanUp();
}
use of com.onesignal.MockOSTimeImpl in project OneSignal-Android-SDK by OneSignal.
the class OutcomeEventV2UnitTests method beforeEachTest.
// Before each test
@Before
public void beforeEachTest() throws Exception {
outcomeEvents = null;
dbHelper = new MockOneSignalDBHelper(ApplicationProvider.getApplicationContext());
// Mock on a custom HashMap in order to not use custom context
preferences = new MockOSSharedPreferences();
// Save v2 flag
String v2Name = preferences.getOutcomesV2KeyName();
preferences.saveBool(preferences.getPreferencesName(), v2Name, true);
MockOSTimeImpl time = new MockOSTimeImpl();
trackerFactory = new OSTrackerFactory(preferences, logWrapper, time);
sessionManager = new MockSessionManager(sessionListener, trackerFactory, logWrapper);
service = new MockOneSignalAPIClient();
OSOutcomeEventsFactory factory = new OSOutcomeEventsFactory(logWrapper, service, dbHelper, preferences);
controller = new MockOutcomeEventsController(sessionManager, factory);
TestHelpers.beforeTestInitAndCleanup();
repository = factory.getRepository();
trackerFactory.saveInfluenceParams(new OneSignalPackagePrivateHelper.RemoteOutcomeParams());
OneSignal.setAppId(APP_ID);
}
use of com.onesignal.MockOSTimeImpl in project OneSignal-Android-SDK by OneSignal.
the class SessionManagerUnitTests method beforeEachTest.
// Before each test
@Before
public void beforeEachTest() throws Exception {
MockOSLog logger = new MockOSLog();
MockOSTimeImpl time = new MockOSTimeImpl();
preferences = new MockOSSharedPreferences();
trackerFactory = new OSTrackerFactory(preferences, logger, time);
sessionManager = new MockSessionManager(sessionListener, trackerFactory, logger);
TestHelpers.beforeTestInitAndCleanup();
}
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());
}
Aggregations