From 0f599ce8048b3428ebff8f59c32f4908d44fabc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Paczos?= Date: Thu, 9 May 2019 15:06:43 +0200 Subject: [android] keep strong callback reference and use application context during cache path change --- .../java/com/mapbox/mapboxsdk/testapp/storage/FileSourceMapTest.kt | 6 +++--- .../com/mapbox/mapboxsdk/testapp/storage/FileSourceTestUtils.kt | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java') diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceMapTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceMapTest.kt index 0d4823a93d..5e3489d755 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceMapTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceMapTest.kt @@ -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() diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceTestUtils.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceTestUtils.kt index 040b288aa2..c69321581a 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceTestUtils.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceTestUtils.kt @@ -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") } }) -- cgit v1.2.1