use of com.onesignal.MockOSLog 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.MockOSLog in project OneSignal-Android-SDK by OneSignal.
the class InAppMessageIntegrationTests method testInAppMessageClickActionOutcomeV2.
@Test
public void testInAppMessageClickActionOutcomeV2() throws Exception {
// Enable IAM v2
preferences = new MockOSSharedPreferences();
preferences.saveBool(preferences.getPreferencesName(), preferences.getOutcomesV2KeyName(), true);
trackerFactory = new OSTrackerFactory(preferences, new MockOSLog(), time);
sessionManager = new MockSessionManager(OneSignal_getSessionListener(), trackerFactory, new MockOSLog());
OneSignal_setSharedPreferences(preferences);
OneSignal_setTrackerFactory(trackerFactory);
OneSignal_setSessionManager(sessionManager);
// 1. Init OneSignal
OneSignalInit();
threadAndTaskWait();
// Enable influence outcomes
trackerFactory.saveInfluenceParams(new OneSignalPackagePrivateHelper.RemoteOutcomeParams());
// 2. Create an IAM
final OSTestInAppMessageInternal message = InAppMessagingHelpers.buildTestMessageWithSingleTrigger(OSTriggerKind.SESSION_TIME, null, OSTestTrigger.OSTriggerOperator.NOT_EXISTS.toString(), null);
final JSONArray outcomes = new JSONArray();
outcomes.put(new JSONObject() {
{
put("name", IAM_OUTCOME_NAME);
}
});
JSONObject action = new JSONObject() {
{
put("id", IAM_CLICK_ID);
put("outcomes", outcomes);
}
};
OneSignalPackagePrivateHelper.onMessageActionOccurredOnMessage(message, action);
// 3. Ensure outcome is sent
assertMeasureOnV2AtIndex(3, "outcome_name", new JSONArray().put(message.getMessageId()), new JSONArray(), null, null);
}
use of com.onesignal.MockOSLog 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.MockOSLog 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.MockOSLog in project OneSignal-Android-SDK by OneSignal.
the class InAppMessageIntegrationTests method beforeEachTest.
@Before
public void beforeEachTest() throws Exception {
ShadowDynamicTimer.shouldScheduleTimers = true;
time = new MockOSTimeImpl();
preferences = new MockOSSharedPreferences();
trackerFactory = new OSTrackerFactory(preferences, new MockOSLog(), time);
sessionManager = new MockSessionManager(OneSignal_getSessionListener(), trackerFactory, new MockOSLog());
blankActivityController = Robolectric.buildActivity(BlankActivity.class).create();
blankActivity = blankActivityController.get();
dbHelper = new MockOneSignalDBHelper(ApplicationProvider.getApplicationContext());
TestHelpers.beforeTestInitAndCleanup();
// Set remote_params GET response
setRemoteParamsGetHtmlResponse();
}
Aggregations