diff options
author | Nancy Chen <nancychen@google.com> | 2014-10-08 20:17:55 -0700 |
---|---|---|
committer | Nancy Chen <nancychen@google.com> | 2014-10-15 15:01:36 -0700 |
commit | e80d62229bb11a92f0db8d4e4bac6533bbed9b66 (patch) | |
tree | 5a44adccf4d5b84655d41c53d7fb7ff01fe2a57f /tests/src/com | |
parent | 8ba957f15593347ab800388a4013a0d7b38ad097 (diff) |
Enable use of phone accounts for voicemail info display.
Call the "isVoicemailNumber(subId, number)" method instead
of the one with just the number. This is because we need to check
whether a number is the voicemail number for a specific phone account,
otherwise the UI would never correctly display "voicemail" for the
non-default SIM.
Bug:17925501
Change-Id: If1d6cb1acfcb570aca5e639858af8804bac202c0
Diffstat (limited to 'tests/src/com')
3 files changed, 25 insertions, 25 deletions
diff --git a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java index bc7c033b2..7ae2c2293 100644 --- a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java +++ b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java @@ -25,7 +25,6 @@ import android.text.Spanned; import android.view.View; import android.widget.TextView; -import com.android.dialer.calllog.CallTypeHelper; import com.android.dialer.calllog.TestPhoneNumberUtilsWrapper; import com.android.dialer.util.LocaleTestUtils; @@ -60,16 +59,17 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { private PhoneCallDetailsViews mViews; private TextView mNameView; private LocaleTestUtils mLocaleTestUtils; + private TestPhoneNumberUtilsWrapper mPhoneUtils; @Override protected void setUp() throws Exception { super.setUp(); Context context = getContext(); Resources resources = context.getResources(); - CallTypeHelper callTypeHelper = new CallTypeHelper(resources); + mPhoneUtils = new TestPhoneNumberUtilsWrapper(context, TEST_VOICEMAIL_NUMBER); final TestPhoneNumberUtilsWrapper phoneUtils = new TestPhoneNumberUtilsWrapper( - TEST_VOICEMAIL_NUMBER); - mHelper = new PhoneCallDetailsHelper(resources, callTypeHelper, phoneUtils); + context, TEST_VOICEMAIL_NUMBER); + mHelper = new PhoneCallDetailsHelper(context, resources, phoneUtils); mHelper.setCurrentTimeForTest( new GregorianCalendar(2011, 5, 4, 13, 0, 0).getTimeInMillis()); mViews = PhoneCallDetailsViews.createForTest(context); @@ -311,8 +311,7 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { mHelper.setPhoneCallDetails(mViews, new PhoneCallDetails(number, presentation, formattedNumber, TEST_COUNTRY_ISO, TEST_GEOCODE, - new int[]{ Calls.VOICEMAIL_TYPE }, TEST_DATE, TEST_DURATION, null, null, 0, - null, null) + new int[]{ Calls.VOICEMAIL_TYPE }, TEST_DATE, TEST_DURATION) ); } @@ -322,8 +321,7 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { mHelper.setPhoneCallDetails(mViews, new PhoneCallDetails(number, Calls.PRESENTATION_ALLOWED, formattedNumber, TEST_COUNTRY_ISO, geocodedLocation, - new int[]{ Calls.VOICEMAIL_TYPE }, TEST_DATE, TEST_DURATION, null, null, 0, - null, null) + new int[]{ Calls.VOICEMAIL_TYPE }, TEST_DATE, TEST_DURATION) ); } @@ -352,7 +350,7 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { mHelper.setPhoneCallDetails(mViews, new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED, TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, - new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION, null, null, + new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION, null, features, null, null) ); } @@ -361,8 +359,8 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { mHelper.setCallDetailsHeader(mNameView, new PhoneCallDetails(number, presentation, TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, - new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION, null, null, 0, - null, null)); + new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION, null, + 0, null, null)); } private void setCallDetailsHeader(String name) { @@ -370,6 +368,6 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED, TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION, - name, 0, "", null, null, 0, null, null, 0, null, null)); + name, 0, "", null, null, 0, null, 0, null, null)); } } diff --git a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java index 85dbf8c83..c0347cf0f 100644 --- a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java @@ -60,12 +60,11 @@ public class CallLogListItemHelperTest extends AndroidTestCase { super.setUp(); Context context = getContext(); mResources = context.getResources(); - CallTypeHelper callTypeHelper = new CallTypeHelper(mResources); - final TestPhoneNumberUtilsWrapper phoneUtils = new TestPhoneNumberUtilsWrapper( - TEST_VOICEMAIL_NUMBER); - PhoneCallDetailsHelper phoneCallDetailsHelper = new PhoneCallDetailsHelper( - mResources, callTypeHelper, phoneUtils); - mPhoneNumberDisplayHelper = new PhoneNumberDisplayHelper(mResources); + final TestPhoneNumberUtilsWrapper phoneUtils = + new TestPhoneNumberUtilsWrapper(context, TEST_VOICEMAIL_NUMBER); + PhoneCallDetailsHelper phoneCallDetailsHelper = + new PhoneCallDetailsHelper(context, mResources, phoneUtils); + mPhoneNumberDisplayHelper = new PhoneNumberDisplayHelper(context, mResources, phoneUtils); mHelper = new CallLogListItemHelper(phoneCallDetailsHelper, mPhoneNumberDisplayHelper, mResources); mViews = CallLogListItemViews.createForTest(context); @@ -319,10 +318,9 @@ public class CallLogListItemHelperTest extends AndroidTestCase { */ public void testGetCallDescription_Video() { PhoneCallDetails details = new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED, - TEST_FORMATTED_NUMBER, - TEST_COUNTRY_ISO, TEST_GEOCODE, + TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, new int[]{Calls.INCOMING_TYPE, Calls.INCOMING_TYPE}, TEST_DATE, TEST_DURATION, - null, null, Calls.FEATURES_VIDEO, null, null); + null, Calls.FEATURES_VIDEO, null, null); CharSequence description = mHelper.getCallDescription(getContext(), details); assertTrue(description.toString() diff --git a/tests/src/com/android/dialer/calllog/TestPhoneNumberUtilsWrapper.java b/tests/src/com/android/dialer/calllog/TestPhoneNumberUtilsWrapper.java index 7266d8890..24916db9e 100644 --- a/tests/src/com/android/dialer/calllog/TestPhoneNumberUtilsWrapper.java +++ b/tests/src/com/android/dialer/calllog/TestPhoneNumberUtilsWrapper.java @@ -16,19 +16,23 @@ package com.android.dialer.calllog; +import android.content.Context; +import android.telecom.PhoneAccountHandle; + /** - * Modified version of {@link com.android.dialer.calllog.PhoneNumberDisplayHelper} to be used in tests - * that allows injecting the voicemail number. + * Modified version of {@link com.android.dialer.calllog.PhoneNumberDisplayHelper} to be used in + * tests that allows injecting the voicemail number. */ public final class TestPhoneNumberUtilsWrapper extends PhoneNumberUtilsWrapper { private CharSequence mVoicemailNumber; - public TestPhoneNumberUtilsWrapper(CharSequence voicemailNumber) { + public TestPhoneNumberUtilsWrapper(Context context, CharSequence voicemailNumber) { + super(context); mVoicemailNumber = voicemailNumber; } @Override - public boolean isVoicemailNumber(CharSequence number) { + public boolean isVoicemailNumber(PhoneAccountHandle accountHandle, CharSequence number) { return mVoicemailNumber.equals(number); } } |