diff options
author | Brandon Maxwell <maxwelb@google.com> | 2016-03-13 16:20:52 -0700 |
---|---|---|
committer | Brandon Maxwell <maxwelb@google.com> | 2016-03-15 14:25:36 -0700 |
commit | 60d449f45f52c22d7f7e669760457b717352f8de (patch) | |
tree | 69afb2476817f4093d16d6598c8d7b047f2341b2 /tests/src/com/android | |
parent | aae1559613cc24ad1d960b550c15af9f61675f38 (diff) |
Updating settings to use system blocked numbers ui
+ After the user has migrated to the framework number blocking
solution, the 'Call blocking' setting needs to take them to the
system ui. The branching logic to determine which UI to open is added
in this CL.
Bug: 26664600
Change-Id: I2574f0665d3f0d3d92230e0210c69d1d10b60228
Diffstat (limited to 'tests/src/com/android')
-rw-r--r-- | tests/src/com/android/dialer/compat/FilteredNumberCompatTest.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/src/com/android/dialer/compat/FilteredNumberCompatTest.java b/tests/src/com/android/dialer/compat/FilteredNumberCompatTest.java index a57e1c29c..5ee2f28e1 100644 --- a/tests/src/com/android/dialer/compat/FilteredNumberCompatTest.java +++ b/tests/src/com/android/dialer/compat/FilteredNumberCompatTest.java @@ -20,14 +20,17 @@ import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.when; +import android.content.ComponentName; import android.content.ContentUris; import android.content.ContentValues; import android.content.Context; +import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.provider.BlockedNumberContract.BlockedNumbers; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; +import android.util.Log; import com.android.contacts.common.compat.CompatUtils; import com.android.dialer.DialerApplication; @@ -35,6 +38,7 @@ import com.android.dialer.database.FilteredNumberContract.FilteredNumber; import com.android.dialer.database.FilteredNumberContract.FilteredNumberColumns; import com.android.dialer.database.FilteredNumberContract.FilteredNumberSources; import com.android.dialer.database.FilteredNumberContract.FilteredNumberTypes; +import com.android.dialer.filterednumber.BlockedNumbersSettingsActivity; import org.mockito.Mock; import org.mockito.Mockito; @@ -179,6 +183,50 @@ public class FilteredNumberCompatTest extends AndroidTestCase { FilteredNumberCompat.newBlockNumberContentValues(NON_E164_NUMBER, null, null)); } + public void testCreateManageBlockedNumbersIntent_NullContext() { + try { + FilteredNumberCompat.createManageBlockedNumbersIntent(null); + fail(); + } catch (NullPointerException e) {} + } + + public void testCreateManageBlockedNumbersIntent_M() { + if (CompatUtils.isNCompatible()) { + return; + } + assertEquals(new ComponentName(getContext(), BlockedNumbersSettingsActivity.class), + FilteredNumberCompat.createManageBlockedNumbersIntent(getContext()).getComponent()); + } + + public void testCreateManageBlockedNumbersIntent_N_Disabled_NotMigrated() { + if (!CompatUtils.isNCompatible()) { + return; + } + FilteredNumberCompat.setIsEnabledForTest(false); + assertEquals(new ComponentName(getContext(), BlockedNumbersSettingsActivity.class), + FilteredNumberCompat.createManageBlockedNumbersIntent(getContext()).getComponent()); + } + + public void testCreateManageBlockedNumbersIntent_N_Enabled_NotMigrated() { + if (!CompatUtils.isNCompatible()) { + return; + } + assertEquals(new ComponentName(getContext(), BlockedNumbersSettingsActivity.class), + FilteredNumberCompat.createManageBlockedNumbersIntent(getContext()).getComponent()); + } + + public void testCreateManageBlockedNumbersIntent_N_Enabled_Migrated() { + if (!CompatUtils.isNCompatible()) { + return; + } + when(mSharedPreferences + .getBoolean(FilteredNumberCompat.HAS_MIGRATED_TO_NEW_BLOCKING_KEY, false)) + .thenReturn(true); + assertFalse(new ComponentName(getContext(), BlockedNumbersSettingsActivity.class) + .equals(FilteredNumberCompat.createManageBlockedNumbersIntent(getContext()) + .getComponent())); + } + private ContentValues newExpectedContentValuesM(String number, String e164Number, String countryIso) { ContentValues contentValues = new ContentValues(); |