diff --git a/mobile/android/app/src/test/java/org/mozilla/gecko/cleanup/TestFileCleanupService.java b/mobile/android/app/src/test/java/org/mozilla/gecko/cleanup/TestFileCleanupService.java index dc835d2ba6e0..08e7370f1d8c 100644 --- a/mobile/android/app/src/test/java/org/mozilla/gecko/cleanup/TestFileCleanupService.java +++ b/mobile/android/app/src/test/java/org/mozilla/gecko/cleanup/TestFileCleanupService.java @@ -6,6 +6,7 @@ package org.mozilla.gecko.cleanup; +import android.content.Context; import android.content.Intent; import org.junit.Rule; @@ -21,6 +22,7 @@ import java.util.List; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; /** * Tests the methods of {@link FileCleanupService}. @@ -43,8 +45,9 @@ public class TestFileCleanupService { } private void onHandleIntent(final ArrayList filePaths) { + final Context context = mock(Context.class); final FileCleanupService service = new FileCleanupService(); - final Intent fileCleanupIntent = FileCleanupService.getFileCleanupIntent(filePaths); + final Intent fileCleanupIntent = FileCleanupService.getFileCleanupIntent(context, filePaths); service.onHandleWork(fileCleanupIntent); } diff --git a/mobile/android/base/java/org/mozilla/gecko/cleanup/FileCleanupController.java b/mobile/android/base/java/org/mozilla/gecko/cleanup/FileCleanupController.java index 979ceb9c6b94..858353b50404 100644 --- a/mobile/android/base/java/org/mozilla/gecko/cleanup/FileCleanupController.java +++ b/mobile/android/base/java/org/mozilla/gecko/cleanup/FileCleanupController.java @@ -54,7 +54,7 @@ public class FileCleanupController { recordCleanupScheduled(sharedPrefs); final Intent fileCleanupIntent = - FileCleanupService.getFileCleanupIntent(getFilesToCleanup(profilePath + "/")); + FileCleanupService.getFileCleanupIntent(context, getFilesToCleanup(profilePath + "/")); FileCleanupService.enqueueWork(context, fileCleanupIntent); } diff --git a/mobile/android/base/java/org/mozilla/gecko/cleanup/FileCleanupService.java b/mobile/android/base/java/org/mozilla/gecko/cleanup/FileCleanupService.java index b32c2b8a92c6..95c9a5fc487b 100644 --- a/mobile/android/base/java/org/mozilla/gecko/cleanup/FileCleanupService.java +++ b/mobile/android/base/java/org/mozilla/gecko/cleanup/FileCleanupService.java @@ -44,8 +44,8 @@ public class FileCleanupService extends JobIntentService { enqueueWork(context, FileCleanupService.class, JobIdsConstants.getIdForFileCleanupJob(), workIntent); } - public static Intent getFileCleanupIntent(ArrayList filesToCleanup) { - Intent intent = new Intent(); + public static Intent getFileCleanupIntent(Context context, ArrayList filesToCleanup) { + Intent intent = new Intent(context, FileCleanupService.class); intent.setAction(FileCleanupService.ACTION_DELETE_FILES); intent.putExtra(FileCleanupService.EXTRA_FILE_PATHS_TO_DELETE, filesToCleanup); return intent;