mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 22:07:41 +00:00
Bug 1019793 - Avoid UnsupportedOperationException in TestHealthReportPruneService. r=mcomella
========ce21e7f19a
Author: Nick Alexander <nalexander@mozilla.com> Date: Wed Jun 4 14:15:09 2014 -0700 Bug 1019793 - Always upload in TestHealthReportUploadService. ========e4c7393c6f
Author: Nick Alexander <nalexander@mozilla.com> Date: Tue Jun 3 15:47:33 2014 -0700 Bug 1019793 - Don't create storage in TestHealthReportPruneService. Creating real storage requires a valid Context, and in this test, we only have MockContext.
This commit is contained in:
parent
1cc245ea64
commit
f718c2014c
@ -10,7 +10,6 @@ import org.mozilla.gecko.background.helpers.BackgroundServiceTestCase;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.test.mock.MockContext;
|
||||
|
||||
public class TestHealthReportPruneService
|
||||
extends BackgroundServiceTestCase<TestHealthReportPruneService.MockHealthReportPruneService> {
|
||||
@ -37,7 +36,10 @@ public class TestHealthReportPruneService
|
||||
|
||||
@Override
|
||||
public PrunePolicy getPrunePolicy(final String profilePath) {
|
||||
final PrunePolicyStorage storage = new PrunePolicyDatabaseStorage(new MockContext(), profilePath);
|
||||
// We don't actually need any storage, so just make it null. Actually
|
||||
// creating storage requires a valid context; here, we only have a
|
||||
// MockContext.
|
||||
final PrunePolicyStorage storage = null;
|
||||
prunePolicy = new MockPrunePolicy(storage, getSharedPreferences());
|
||||
return prunePolicy;
|
||||
}
|
||||
|
@ -21,6 +21,12 @@ public class TestHealthReportUploadService
|
||||
GlobalConstants.SHARED_PREFERENCES_MODE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean backgroundDataIsEnabled() {
|
||||
// When testing, we always want to say we can upload.
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHandleIntent(Intent intent) {
|
||||
super.onHandleIntent(intent);
|
||||
|
Loading…
x
Reference in New Issue
Block a user