diff options
Diffstat (limited to 'tests/src/com/android/dialer/filterednumber/FilteredNumbersUtilTest.java')
-rw-r--r-- | tests/src/com/android/dialer/filterednumber/FilteredNumbersUtilTest.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/src/com/android/dialer/filterednumber/FilteredNumbersUtilTest.java b/tests/src/com/android/dialer/filterednumber/FilteredNumbersUtilTest.java index 180295cba..ccd95ab69 100644 --- a/tests/src/com/android/dialer/filterednumber/FilteredNumbersUtilTest.java +++ b/tests/src/com/android/dialer/filterednumber/FilteredNumbersUtilTest.java @@ -15,6 +15,7 @@ */ package com.android.dialer.filterednumber; +import android.preference.PreferenceManager; import android.test.AndroidTestCase; import com.android.contacts.common.test.mocks.ContactsMockContext; @@ -46,6 +47,12 @@ public class FilteredNumbersUtilTest extends AndroidTestCase { public void setUp() throws Exception { super.setUp(); mContext = new ContactsMockContext(getContext(), FilteredNumberContract.AUTHORITY); + + // Reset whether an emergency number was dialed + PreferenceManager.getDefaultSharedPreferences(mContext) + .edit() + .putLong(FilteredNumbersUtil.LAST_EMERGENCY_CALL_MS_PREF_KEY, 0) + .apply(); } public void testShouldBlockVoicemail_NotBlocked() { @@ -78,6 +85,17 @@ public class FilteredNumbersUtilTest extends AndroidTestCase { COUNTRY_ISO, EARLIER_TIME + 30000)); } + public void testShouldBlockVoicemail_AfterEmergencyCall() { + // Just called emergency services + PreferenceManager.getDefaultSharedPreferences(mContext) + .edit() + .putLong(FilteredNumbersUtil.LAST_EMERGENCY_CALL_MS_PREF_KEY, + System.currentTimeMillis()) + .apply(); + assertFalse(FilteredNumbersUtil.shouldBlockVoicemail(mContext, NORMALIZED_NUMBER, + COUNTRY_ISO, 0)); + } + private void setupShouldBlockVoicemailQuery(long creationTimeMs) { Query query = mContext.getContactsProvider().expectQuery(FilteredNumber.CONTENT_URI) .withProjection(FILTERED_NUMBER_PROJECTION) |