[android] keep strong callback reference and use application context during cache path change
This commit is contained in:
committed by
Łukasz Paczos
parent
e0f32000df
commit
0f599ce804
@@ -36,12 +36,12 @@ open class FileSourceMapTest {
|
||||
fun changeResourcesPathWhileMapVisible() {
|
||||
val latch = CountDownLatch(1)
|
||||
rule.activity.runOnUiThread {
|
||||
FileSource.setResourcesCachePath(rule.activity, fileSourceTestUtils.testPath, object : FileSource.ResourcesCachePathChangeCallback {
|
||||
override fun onSuccess(path: String?) {
|
||||
FileSource.setResourcesCachePath(fileSourceTestUtils.testPath, object : FileSource.ResourcesCachePathChangeCallback {
|
||||
override fun onSuccess(path: String) {
|
||||
Assert.fail("Requested resources change while the map is running should fail")
|
||||
}
|
||||
|
||||
override fun onError(message: String?) {
|
||||
override fun onError(message: String) {
|
||||
Assert.assertEquals("Cannot set path, file source is activated."
|
||||
+ " Make sure that the map or a resources download is not running.", message)
|
||||
latch.countDown()
|
||||
|
||||
@@ -33,14 +33,13 @@ class FileSourceTestUtils(private val activity: Activity) {
|
||||
val latch = CountDownLatch(1)
|
||||
activity.runOnUiThread {
|
||||
FileSource.setResourcesCachePath(
|
||||
activity,
|
||||
path,
|
||||
object : FileSource.ResourcesCachePathChangeCallback {
|
||||
override fun onSuccess(path: String?) {
|
||||
override fun onSuccess(path: String) {
|
||||
latch.countDown()
|
||||
}
|
||||
|
||||
override fun onError(message: String?) {
|
||||
override fun onError(message: String) {
|
||||
Assert.fail("Resource path change failed - path: $path, message: $message")
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user