-
-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bugfix: PublicAPI stop should not start TrackRecordingService in fore…
…ground. Actually, TrackRecordingService will only be start in foreground if needed. Fixes #1824.
- Loading branch information
1 parent
cb9b947
commit 1bd3d66
Showing
5 changed files
with
85 additions
and
7 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
src/androidTest/java/de/dennisguse/opentracks/publicapi/PublicApiTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package de.dennisguse.opentracks.publicapi; | ||
|
||
import android.content.Context; | ||
|
||
import androidx.test.core.app.ApplicationProvider; | ||
import androidx.test.ext.junit.runners.AndroidJUnit4; | ||
import androidx.test.filters.LargeTest; | ||
import androidx.test.rule.GrantPermissionRule; | ||
|
||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import de.dennisguse.opentracks.R; | ||
import de.dennisguse.opentracks.TestUtil; | ||
import de.dennisguse.opentracks.settings.PreferencesUtils; | ||
import de.dennisguse.opentracks.util.IntentUtils; | ||
|
||
@LargeTest | ||
@RunWith(AndroidJUnit4.class) | ||
public class PublicApiTest { | ||
|
||
@Rule | ||
public GrantPermissionRule mGrantPermissionRule = TestUtil.createGrantPermissionRule(); | ||
|
||
private final Context context = ApplicationProvider.getApplicationContext(); | ||
|
||
@Test | ||
public void StartTest() { | ||
PreferencesUtils.setBoolean(R.string.publicapi_enabled_key, true); | ||
|
||
context.startActivity(IntentUtils.newIntent(context, StartRecording.class)); | ||
} | ||
|
||
@Test | ||
public void StartStopTest() throws InterruptedException { | ||
PreferencesUtils.setBoolean(R.string.publicapi_enabled_key, true); | ||
|
||
context.startActivity(IntentUtils.newIntent(context, StartRecording.class)); | ||
|
||
Thread.sleep(5000); | ||
|
||
context.startActivity(IntentUtils.newIntent(context, StopRecording.class)); | ||
} | ||
|
||
@Test | ||
public void StopAndWait() throws InterruptedException { | ||
PreferencesUtils.setBoolean(R.string.publicapi_enabled_key, true); | ||
|
||
context.startActivity(IntentUtils.newIntent(context, StopRecording.class)); | ||
|
||
Thread.sleep(10000); | ||
|
||
//No ForegroundServiceDidNotStartInTimeException should be happening. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters