Search in sources :

Example 6 with MockOSTimeImpl

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());
}
Also used : OSTestInAppMessageInternal(com.onesignal.OneSignalPackagePrivateHelper.OSTestInAppMessageInternal) MockOSTimeImpl(com.onesignal.MockOSTimeImpl) Test(org.junit.Test)

Example 7 with MockOSTimeImpl

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);
}
Also used : MockOSLog(com.onesignal.MockOSLog) OSTrackerFactory(com.onesignal.influence.data.OSTrackerFactory) MockOneSignalDBHelper(com.onesignal.MockOneSignalDBHelper) MockOSTimeImpl(com.onesignal.MockOSTimeImpl) MockSessionManager(com.onesignal.MockSessionManager) MockOSSharedPreferences(com.onesignal.MockOSSharedPreferences) Before(org.junit.Before)

Example 8 with MockOSTimeImpl

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();
}
Also used : MockOSTimeImpl(com.onesignal.MockOSTimeImpl) Before(org.junit.Before)

Example 9 with MockOSTimeImpl

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);
}
Also used : MockOSLog(com.onesignal.MockOSLog) OSTrackerFactory(com.onesignal.influence.data.OSTrackerFactory) MockOneSignalDBHelper(com.onesignal.MockOneSignalDBHelper) MockOSTimeImpl(com.onesignal.MockOSTimeImpl) MockSessionManager(com.onesignal.MockSessionManager) MockOSSharedPreferences(com.onesignal.MockOSSharedPreferences) Before(org.junit.Before)

Example 10 with MockOSTimeImpl

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);
}
Also used : MockOSLog(com.onesignal.MockOSLog) OSTrackerFactory(com.onesignal.influence.data.OSTrackerFactory) MockOSTimeImpl(com.onesignal.MockOSTimeImpl) MockOSSharedPreferences(com.onesignal.MockOSSharedPreferences) Before(org.junit.Before)

Aggregations

MockOSTimeImpl (com.onesignal.MockOSTimeImpl)13 Before (org.junit.Before)12 OSTrackerFactory (com.onesignal.influence.data.OSTrackerFactory)9 MockOSSharedPreferences (com.onesignal.MockOSSharedPreferences)8 MockOneSignalDBHelper (com.onesignal.MockOneSignalDBHelper)8 MockSessionManager (com.onesignal.MockSessionManager)8 MockOSLog (com.onesignal.MockOSLog)6 OneSignalPackagePrivateHelper (com.onesignal.OneSignalPackagePrivateHelper)3 MockOneSignalAPIClient (com.onesignal.MockOneSignalAPIClient)2 MockOutcomeEventsController (com.onesignal.MockOutcomeEventsController)2 OSOutcomeEventsFactory (com.onesignal.outcomes.data.OSOutcomeEventsFactory)2 NotificationManager (android.app.NotificationManager)1 OSTestInAppMessageInternal (com.onesignal.OneSignalPackagePrivateHelper.OSTestInAppMessageInternal)1 ShadowRoboNotificationManager (com.onesignal.ShadowRoboNotificationManager)1 Test (org.junit.Test)1