diff options
Diffstat (limited to 'tests/src')
7 files changed, 165 insertions, 94 deletions
diff --git a/tests/src/com/android/dialer/CallDetailActivityTest.java b/tests/src/com/android/dialer/CallDetailActivityTest.java index 59c2434f2..27fbc304e 100644 --- a/tests/src/com/android/dialer/CallDetailActivityTest.java +++ b/tests/src/com/android/dialer/CallDetailActivityTest.java @@ -33,6 +33,7 @@ import android.widget.PopupMenu; import android.widget.TextView; import com.android.dialer.calllog.CallLogAsyncTaskUtil; +import com.android.dialer.util.AppCompatConstants; import com.android.dialer.util.AsyncTaskExecutors; import com.android.dialer.util.FakeAsyncTaskExecutor; @@ -121,7 +122,7 @@ public class CallDetailActivityTest extends ActivityInstrumentationTestCase2<Cal ContentValues values = new ContentValues(); values.put(CallLog.Calls.NUMBER, CONTACT_NUMBER); values.put(CallLog.Calls.NUMBER_PRESENTATION, CallLog.Calls.PRESENTATION_ALLOWED); - values.put(CallLog.Calls.TYPE, CallLog.Calls.INCOMING_TYPE); + values.put(CallLog.Calls.TYPE, AppCompatConstants.CALLS_INCOMING_TYPE); mCallLogUri = contentResolver.insert(CallLog.Calls.CONTENT_URI, values); setActivityIntent(new Intent(Intent.ACTION_VIEW, mCallLogUri)); } diff --git a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java index 83d098fc5..3a79695be 100644 --- a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java @@ -35,6 +35,7 @@ import android.view.View; import com.android.dialer.contactinfo.ContactInfoCache; import com.android.dialer.contactinfo.ContactInfoCache.OnContactInfoChangedListener; +import com.android.dialer.util.AppCompatConstants; import com.android.dialer.util.TestConstants; import com.google.common.collect.Lists; @@ -344,7 +345,7 @@ public class CallLogAdapterTest extends AndroidTestCase { public void testBindView_UriNumber() { createCallLogEntryWithCachedValues( "sip:johndoe@gmail.com", - Calls.INCOMING_TYPE, + AppCompatConstants.CALLS_INCOMING_TYPE, "John Doe", Phone.TYPE_HOME, TEST_DEFAULT_CUSTOM_LABEL, @@ -404,7 +405,7 @@ public class CallLogAdapterTest extends AndroidTestCase { public void testBindView_NumberOnlyDbCachedFormattedNumber() { createCallLogEntryWithCachedValues( TEST_NUMBER, - Calls.INCOMING_TYPE, + AppCompatConstants.CALLS_INCOMING_TYPE, EMPTY_STRING, TEST_CACHED_NUMBER_TYPE, TEST_CACHED_NUMBER_LABEL, @@ -454,11 +455,17 @@ public class CallLogAdapterTest extends AndroidTestCase { } private void createPrivateCallLogEntry() { - createCallLogEntry(EMPTY_STRING, Calls.PRESENTATION_RESTRICTED, Calls.INCOMING_TYPE); + createCallLogEntry( + EMPTY_STRING, + Calls.PRESENTATION_RESTRICTED, + AppCompatConstants.CALLS_INCOMING_TYPE); } private void createUnknownCallLogEntry() { - createCallLogEntry(EMPTY_STRING, Calls.PRESENTATION_UNKNOWN, Calls.INCOMING_TYPE); + createCallLogEntry( + EMPTY_STRING, + Calls.PRESENTATION_UNKNOWN, + AppCompatConstants.CALLS_INCOMING_TYPE); } private void createVoicemailCallLogEntry() { @@ -499,7 +506,7 @@ public class CallLogAdapterTest extends AndroidTestCase { * It includes the values for the cached contact associated with the number. * * @param number The phone number. - * @param type Either Call.OUTGOING_TYPE or Call.INCOMING_TYPE or Call.MISSED_TYPE. + * @param type Valid value of {@code Calls.TYPE}. * @param cachedName The name of the contact with this number * @param cachedNumberType The type of the number, from the contact with this number. * @param cachedNumberLabel The label of the number, from the contact with this number. @@ -555,7 +562,7 @@ public class CallLogAdapterTest extends AndroidTestCase { if (type != NO_VALUE_SET) { values[CallLogQuery.CALL_TYPE] = type; } - if (type == Calls.VOICEMAIL_TYPE) { + if (type == AppCompatConstants.CALLS_VOICEMAIL_TYPE) { values[CallLogQuery.VOICEMAIL_URI] = ContentUris.withAppendedId( VoicemailContract.Voicemails.CONTENT_URI, mCursor.getCount()); } diff --git a/tests/src/com/android/dialer/calllog/CallLogGroupBuilderTest.java b/tests/src/com/android/dialer/calllog/CallLogGroupBuilderTest.java index 9bdcd40c0..f5a9fe612 100644 --- a/tests/src/com/android/dialer/calllog/CallLogGroupBuilderTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogGroupBuilderTest.java @@ -19,10 +19,11 @@ package com.android.dialer.calllog; import static com.google.common.collect.Lists.newArrayList; import android.database.MatrixCursor; -import android.provider.CallLog.Calls; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; +import com.android.dialer.util.AppCompatConstants; + import java.util.List; /** @@ -64,31 +65,31 @@ public class CallLogGroupBuilderTest extends AndroidTestCase { } public void testAddGroups_OneCall() { - addCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE); + addCallLogEntry(TEST_NUMBER1, AppCompatConstants.CALLS_INCOMING_TYPE); mBuilder.addGroups(mCursor); assertEquals(1, mFakeGroupCreator.groups.size()); } public void testAddGroups_TwoCallsNotMatching() { - addCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE); - addCallLogEntry(TEST_NUMBER2, Calls.INCOMING_TYPE); + addCallLogEntry(TEST_NUMBER1, AppCompatConstants.CALLS_INCOMING_TYPE); + addCallLogEntry(TEST_NUMBER2, AppCompatConstants.CALLS_INCOMING_TYPE); mBuilder.addGroups(mCursor); assertEquals(2, mFakeGroupCreator.groups.size()); } public void testAddGroups_ThreeCallsMatching() { - addCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE); - addCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE); - addCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE); + addCallLogEntry(TEST_NUMBER1, AppCompatConstants.CALLS_INCOMING_TYPE); + addCallLogEntry(TEST_NUMBER1, AppCompatConstants.CALLS_INCOMING_TYPE); + addCallLogEntry(TEST_NUMBER1, AppCompatConstants.CALLS_INCOMING_TYPE); mBuilder.addGroups(mCursor); assertEquals(1, mFakeGroupCreator.groups.size()); assertGroupIs(0, 3, mFakeGroupCreator.groups.get(0)); } public void testAddGroups_MatchingIncomingAndOutgoing() { - addCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE); - addCallLogEntry(TEST_NUMBER1, Calls.OUTGOING_TYPE); - addCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE); + addCallLogEntry(TEST_NUMBER1, AppCompatConstants.CALLS_INCOMING_TYPE); + addCallLogEntry(TEST_NUMBER1, AppCompatConstants.CALLS_OUTGOING_TYPE); + addCallLogEntry(TEST_NUMBER1, AppCompatConstants.CALLS_INCOMING_TYPE); mBuilder.addGroups(mCursor); assertEquals(1, mFakeGroupCreator.groups.size()); assertGroupIs(0, 3, mFakeGroupCreator.groups.get(0)); @@ -96,57 +97,88 @@ public class CallLogGroupBuilderTest extends AndroidTestCase { public void testAddGroups_Voicemail() { // Does not group with other types of calls, include voicemail themselves. - assertCallsAreNotGrouped(Calls.VOICEMAIL_TYPE, Calls.MISSED_TYPE); - assertCallsAreNotGrouped(Calls.VOICEMAIL_TYPE, Calls.VOICEMAIL_TYPE); - assertCallsAreNotGrouped(Calls.VOICEMAIL_TYPE, Calls.INCOMING_TYPE); - assertCallsAreNotGrouped(Calls.VOICEMAIL_TYPE, Calls.OUTGOING_TYPE); + assertCallsAreNotGrouped( + AppCompatConstants.CALLS_VOICEMAIL_TYPE, AppCompatConstants.CALLS_MISSED_TYPE); + assertCallsAreNotGrouped( + AppCompatConstants.CALLS_VOICEMAIL_TYPE, AppCompatConstants.CALLS_VOICEMAIL_TYPE); + assertCallsAreNotGrouped( + AppCompatConstants.CALLS_VOICEMAIL_TYPE, AppCompatConstants.CALLS_INCOMING_TYPE); + assertCallsAreNotGrouped( + AppCompatConstants.CALLS_VOICEMAIL_TYPE, AppCompatConstants.CALLS_OUTGOING_TYPE); } public void testAddGroups_Missed() { // Groups with one or more missed calls. - assertCallsAreGrouped(Calls.MISSED_TYPE, Calls.MISSED_TYPE); - assertCallsAreGrouped(Calls.MISSED_TYPE, Calls.MISSED_TYPE, Calls.MISSED_TYPE); + assertCallsAreGrouped( + AppCompatConstants.CALLS_MISSED_TYPE, AppCompatConstants.CALLS_MISSED_TYPE); + assertCallsAreGrouped( + AppCompatConstants.CALLS_MISSED_TYPE, + AppCompatConstants.CALLS_MISSED_TYPE, + AppCompatConstants.CALLS_MISSED_TYPE); // Does not group with other types of calls. - assertCallsAreNotGrouped(Calls.MISSED_TYPE, Calls.VOICEMAIL_TYPE); - assertCallsAreGrouped(Calls.MISSED_TYPE, Calls.INCOMING_TYPE); - assertCallsAreGrouped(Calls.MISSED_TYPE, Calls.OUTGOING_TYPE); + assertCallsAreNotGrouped( + AppCompatConstants.CALLS_MISSED_TYPE, AppCompatConstants.CALLS_VOICEMAIL_TYPE); + assertCallsAreGrouped( + AppCompatConstants.CALLS_MISSED_TYPE, AppCompatConstants.CALLS_INCOMING_TYPE); + assertCallsAreGrouped( + AppCompatConstants.CALLS_MISSED_TYPE, AppCompatConstants.CALLS_OUTGOING_TYPE); } public void testAddGroups_Incoming() { // Groups with one or more incoming or outgoing. - assertCallsAreGrouped(Calls.INCOMING_TYPE, Calls.INCOMING_TYPE); - assertCallsAreGrouped(Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE); - assertCallsAreGrouped(Calls.INCOMING_TYPE, Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE); - assertCallsAreGrouped(Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE, Calls.INCOMING_TYPE); - assertCallsAreGrouped(Calls.INCOMING_TYPE, Calls.MISSED_TYPE); + assertCallsAreGrouped( + AppCompatConstants.CALLS_INCOMING_TYPE, AppCompatConstants.CALLS_INCOMING_TYPE); + assertCallsAreGrouped( + AppCompatConstants.CALLS_INCOMING_TYPE, AppCompatConstants.CALLS_OUTGOING_TYPE); + assertCallsAreGrouped( + AppCompatConstants.CALLS_INCOMING_TYPE, + AppCompatConstants.CALLS_INCOMING_TYPE, + AppCompatConstants.CALLS_OUTGOING_TYPE); + assertCallsAreGrouped( + AppCompatConstants.CALLS_INCOMING_TYPE, + AppCompatConstants.CALLS_OUTGOING_TYPE, + AppCompatConstants.CALLS_INCOMING_TYPE); + assertCallsAreGrouped( + AppCompatConstants.CALLS_INCOMING_TYPE, AppCompatConstants.CALLS_MISSED_TYPE); // Does not group with voicemail and missed calls. - assertCallsAreNotGrouped(Calls.INCOMING_TYPE, Calls.VOICEMAIL_TYPE); + assertCallsAreNotGrouped( + AppCompatConstants.CALLS_INCOMING_TYPE, AppCompatConstants.CALLS_VOICEMAIL_TYPE); } public void testAddGroups_Outgoing() { // Groups with one or more incoming or outgoing. - assertCallsAreGrouped(Calls.OUTGOING_TYPE, Calls.INCOMING_TYPE); - assertCallsAreGrouped(Calls.OUTGOING_TYPE, Calls.OUTGOING_TYPE); - assertCallsAreGrouped(Calls.OUTGOING_TYPE, Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE); - assertCallsAreGrouped(Calls.OUTGOING_TYPE, Calls.OUTGOING_TYPE, Calls.INCOMING_TYPE); - assertCallsAreGrouped(Calls.INCOMING_TYPE, Calls.MISSED_TYPE); + assertCallsAreGrouped( + AppCompatConstants.CALLS_OUTGOING_TYPE, AppCompatConstants.CALLS_INCOMING_TYPE); + assertCallsAreGrouped( + AppCompatConstants.CALLS_OUTGOING_TYPE, AppCompatConstants.CALLS_OUTGOING_TYPE); + assertCallsAreGrouped( + AppCompatConstants.CALLS_OUTGOING_TYPE, + AppCompatConstants.CALLS_INCOMING_TYPE, + AppCompatConstants.CALLS_OUTGOING_TYPE); + assertCallsAreGrouped( + AppCompatConstants.CALLS_OUTGOING_TYPE, + AppCompatConstants.CALLS_OUTGOING_TYPE, + AppCompatConstants.CALLS_INCOMING_TYPE); + assertCallsAreGrouped( + AppCompatConstants.CALLS_INCOMING_TYPE, AppCompatConstants.CALLS_MISSED_TYPE); // Does not group with voicemail and missed calls. - assertCallsAreNotGrouped(Calls.INCOMING_TYPE, Calls.VOICEMAIL_TYPE); + assertCallsAreNotGrouped( + AppCompatConstants.CALLS_INCOMING_TYPE, AppCompatConstants.CALLS_VOICEMAIL_TYPE); } public void testAddGroups_Mixed() { addMultipleCallLogEntries(TEST_NUMBER1, - Calls.VOICEMAIL_TYPE, // Group 1:Stand-alone - Calls.INCOMING_TYPE, // Group 2: 1-4 - Calls.OUTGOING_TYPE, - Calls.MISSED_TYPE, - Calls.MISSED_TYPE, - Calls.VOICEMAIL_TYPE, // Group 3: Stand-alone - Calls.INCOMING_TYPE, // Group 4: Stand-alone - Calls.VOICEMAIL_TYPE, // Group 5: Stand-alone - Calls.MISSED_TYPE, // Group 6: 8-10 - Calls.MISSED_TYPE, - Calls.OUTGOING_TYPE); + AppCompatConstants.CALLS_VOICEMAIL_TYPE, // Group 1:Stand-alone + AppCompatConstants.CALLS_INCOMING_TYPE, // Group 2: 1-4 + AppCompatConstants.CALLS_OUTGOING_TYPE, + AppCompatConstants.CALLS_MISSED_TYPE, + AppCompatConstants.CALLS_MISSED_TYPE, + AppCompatConstants.CALLS_VOICEMAIL_TYPE, // Group 3: Stand-alone + AppCompatConstants.CALLS_INCOMING_TYPE, // Group 4: Stand-alone + AppCompatConstants.CALLS_VOICEMAIL_TYPE, // Group 5: Stand-alone + AppCompatConstants.CALLS_MISSED_TYPE, // Group 6: 8-10 + AppCompatConstants.CALLS_MISSED_TYPE, + AppCompatConstants.CALLS_OUTGOING_TYPE); mBuilder.addGroups(mCursor); assertEquals(6, mFakeGroupCreator.groups.size()); assertGroupIs(0, 1, mFakeGroupCreator.groups.get(0)); diff --git a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java index 8c2d8e443..d554ad4d2 100644 --- a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java @@ -25,6 +25,7 @@ import android.view.View; import com.android.contacts.common.CallUtil; import com.android.dialer.PhoneCallDetails; import com.android.dialer.R; +import com.android.dialer.util.AppCompatConstants; /** * Unit tests for {@link CallLogListItemHelper}. @@ -103,20 +104,22 @@ public class CallLogListItemHelperTest extends AndroidTestCase { } public void testSetPhoneCallDetails_ReadVoicemail() { - PhoneCallDetails details = getPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE); + PhoneCallDetails details = + getPhoneCallDetailsWithTypes(AppCompatConstants.CALLS_VOICEMAIL_TYPE); mHelper.setPhoneCallDetails(mViewHolder, details); assertEquals(View.VISIBLE, mViewHolder.voicemailPlaybackView.getVisibility()); } public void testSetPhoneCallDetails_UnreadVoicemail() { - PhoneCallDetails details = getPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE); + PhoneCallDetails details = + getPhoneCallDetailsWithTypes(AppCompatConstants.CALLS_VOICEMAIL_TYPE); mHelper.setPhoneCallDetails(mViewHolder, details); assertEquals(View.VISIBLE, mViewHolder.voicemailPlaybackView.getVisibility()); } public void testSetPhoneCallDetails_VoicemailFromUnknown() { setPhoneCallDetailsWithNumberAndType("", Calls.PRESENTATION_UNKNOWN, - "", Calls.VOICEMAIL_TYPE); + "", AppCompatConstants.CALLS_VOICEMAIL_TYPE); assertEquals(View.VISIBLE, mViewHolder.voicemailPlaybackView.getVisibility()); } @@ -124,7 +127,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { * Test getCallDescriptionID method used to get the accessibility description for calls. */ public void testGetCallDescriptionID_Answered() { - int[] callTypes = new int[]{ Calls.INCOMING_TYPE }; + int[] callTypes = new int[]{ AppCompatConstants.CALLS_INCOMING_TYPE }; assertEquals(R.string.description_incoming_answered_call, mHelper.getCallDescriptionStringID(callTypes)); } @@ -133,7 +136,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { * Test getCallDescriptionID method used to get the accessibility description for calls. */ public void testGetCallDescriptionID_Missed() { - int[] callTypes = new int[]{ Calls.MISSED_TYPE }; + int[] callTypes = new int[]{ AppCompatConstants.CALLS_MISSED_TYPE }; assertEquals(R.string.description_incoming_missed_call, mHelper.getCallDescriptionStringID(callTypes)); } @@ -142,7 +145,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { * Test getCallDescriptionID method used to get the accessibility description for calls. */ public void testGetCallDescriptionID_Voicemail() { - int[] callTypes = new int[]{ Calls.VOICEMAIL_TYPE }; + int[] callTypes = new int[]{ AppCompatConstants.CALLS_VOICEMAIL_TYPE }; assertEquals(R.string.description_incoming_missed_call, mHelper.getCallDescriptionStringID(callTypes)); } @@ -153,7 +156,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { * only a single call for this caller. */ public void testGetCallDescriptionID_OutgoingSingle() { - int[] callTypes = new int[]{ Calls.OUTGOING_TYPE }; + int[] callTypes = new int[]{ AppCompatConstants.CALLS_OUTGOING_TYPE }; assertEquals(R.string.description_outgoing_call, mHelper.getCallDescriptionStringID(callTypes)); } @@ -164,7 +167,10 @@ public class CallLogListItemHelperTest extends AndroidTestCase { * many calls for this caller. */ public void testGetCallDescriptionID_OutgoingMultiple() { - int[] callTypes = new int[]{ Calls.OUTGOING_TYPE, Calls.OUTGOING_TYPE }; + int[] callTypes = new int[]{ + AppCompatConstants.CALLS_OUTGOING_TYPE, + AppCompatConstants.CALLS_OUTGOING_TYPE + }; assertEquals(R.string.description_outgoing_call, mHelper.getCallDescriptionStringID(callTypes)); } @@ -174,8 +180,8 @@ public class CallLogListItemHelperTest extends AndroidTestCase { * For outgoing calls, we should NOT have "New Voicemail" in the description. */ public void testGetCallDescription_NoVoicemailOutgoing() { - PhoneCallDetails details = - getPhoneCallDetailsWithTypes(Calls.OUTGOING_TYPE, Calls.OUTGOING_TYPE); + PhoneCallDetails details = getPhoneCallDetailsWithTypes( + AppCompatConstants.CALLS_OUTGOING_TYPE, AppCompatConstants.CALLS_OUTGOING_TYPE); CharSequence description = mHelper.getCallDescription(details); assertFalse(description.toString() .contains(this.mResources.getString(R.string.description_new_voicemail))); @@ -186,8 +192,8 @@ public class CallLogListItemHelperTest extends AndroidTestCase { * For regular incoming calls, we should NOT have "New Voicemail" in the description. */ public void testGetCallDescription_NoVoicemailIncoming() { - PhoneCallDetails details = - getPhoneCallDetailsWithTypes(Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE); + PhoneCallDetails details = getPhoneCallDetailsWithTypes( + AppCompatConstants.CALLS_INCOMING_TYPE, AppCompatConstants.CALLS_OUTGOING_TYPE); CharSequence description = mHelper.getCallDescription(details); assertFalse(description.toString() .contains(this.mResources.getString(R.string.description_new_voicemail))); @@ -198,8 +204,8 @@ public class CallLogListItemHelperTest extends AndroidTestCase { * For regular missed calls, we should NOT have "New Voicemail" in the description. */ public void testGetCallDescription_NoVoicemailMissed() { - PhoneCallDetails details = - getPhoneCallDetailsWithTypes(Calls.MISSED_TYPE, Calls.OUTGOING_TYPE); + PhoneCallDetails details = getPhoneCallDetailsWithTypes( + AppCompatConstants.CALLS_MISSED_TYPE, AppCompatConstants.CALLS_OUTGOING_TYPE); CharSequence description = mHelper.getCallDescription(details); assertFalse(description.toString() .contains(this.mResources.getString(R.string.description_new_voicemail))); @@ -210,8 +216,8 @@ public class CallLogListItemHelperTest extends AndroidTestCase { * For voicemail calls, we should have "New Voicemail" in the description. */ public void testGetCallDescription_Voicemail() { - PhoneCallDetails details = - getPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE, Calls.OUTGOING_TYPE); + PhoneCallDetails details = getPhoneCallDetailsWithTypes( + AppCompatConstants.CALLS_VOICEMAIL_TYPE, AppCompatConstants.CALLS_OUTGOING_TYPE); CharSequence description = mHelper.getCallDescription(details); assertTrue(description.toString() .contains(this.mResources.getString(R.string.description_new_voicemail))); @@ -222,7 +228,8 @@ public class CallLogListItemHelperTest extends AndroidTestCase { * Test that the "X calls" message is not present if there is only a single call. */ public void testGetCallDescription_NumCallsSingle() { - PhoneCallDetails details = getPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE); + PhoneCallDetails details = + getPhoneCallDetailsWithTypes(AppCompatConstants.CALLS_VOICEMAIL_TYPE); CharSequence description = mHelper.getCallDescription(details); // Rather than hard coding the "X calls" string message, we'll generate it with an empty @@ -238,8 +245,8 @@ public class CallLogListItemHelperTest extends AndroidTestCase { * Test that the "X calls" message is present if there are many calls. */ public void testGetCallDescription_NumCallsMultiple() { - PhoneCallDetails details = - getPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE, Calls.INCOMING_TYPE); + PhoneCallDetails details = getPhoneCallDetailsWithTypes( + AppCompatConstants.CALLS_VOICEMAIL_TYPE, AppCompatConstants.CALLS_INCOMING_TYPE); CharSequence description = mHelper.getCallDescription(details); assertTrue(description.toString() .contains(this.mResources.getString(R.string.description_num_calls, 2))); @@ -250,8 +257,8 @@ public class CallLogListItemHelperTest extends AndroidTestCase { * Test that the "Video call." message is present if the call had video capability. */ public void testGetCallDescription_Video() { - PhoneCallDetails details = - getPhoneCallDetailsWithTypes(Calls.INCOMING_TYPE, Calls.INCOMING_TYPE); + PhoneCallDetails details = getPhoneCallDetailsWithTypes( + AppCompatConstants.CALLS_INCOMING_TYPE, AppCompatConstants.CALLS_INCOMING_TYPE); details.features = Calls.FEATURES_VIDEO; CharSequence description = mHelper.getCallDescription(details); diff --git a/tests/src/com/android/dialer/calllog/PhoneCallDetailsHelperTest.java b/tests/src/com/android/dialer/calllog/PhoneCallDetailsHelperTest.java index be35ad06e..263642c96 100644 --- a/tests/src/com/android/dialer/calllog/PhoneCallDetailsHelperTest.java +++ b/tests/src/com/android/dialer/calllog/PhoneCallDetailsHelperTest.java @@ -27,6 +27,7 @@ import android.widget.TextView; import com.android.dialer.PhoneCallDetails; import com.android.dialer.R; +import com.android.dialer.util.AppCompatConstants; import com.android.dialer.util.LocaleTestUtils; import java.util.GregorianCalendar; @@ -165,17 +166,17 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { } public void testSetPhoneCallDetails_CallTypeIcons() { - setPhoneCallDetailsWithCallTypeIcons(Calls.INCOMING_TYPE); - assertCallTypeIconsEquals(Calls.INCOMING_TYPE); + setPhoneCallDetailsWithCallTypeIcons(AppCompatConstants.CALLS_INCOMING_TYPE); + assertCallTypeIconsEquals(AppCompatConstants.CALLS_INCOMING_TYPE); - setPhoneCallDetailsWithCallTypeIcons(Calls.OUTGOING_TYPE); - assertCallTypeIconsEquals(Calls.OUTGOING_TYPE); + setPhoneCallDetailsWithCallTypeIcons(AppCompatConstants.CALLS_OUTGOING_TYPE); + assertCallTypeIconsEquals(AppCompatConstants.CALLS_OUTGOING_TYPE); - setPhoneCallDetailsWithCallTypeIcons(Calls.MISSED_TYPE); - assertCallTypeIconsEquals(Calls.MISSED_TYPE); + setPhoneCallDetailsWithCallTypeIcons(AppCompatConstants.CALLS_MISSED_TYPE); + assertCallTypeIconsEquals(AppCompatConstants.CALLS_MISSED_TYPE); - setPhoneCallDetailsWithCallTypeIcons(Calls.VOICEMAIL_TYPE); - assertCallTypeIconsEquals(Calls.VOICEMAIL_TYPE); + setPhoneCallDetailsWithCallTypeIcons(AppCompatConstants.CALLS_VOICEMAIL_TYPE); + assertCallTypeIconsEquals(AppCompatConstants.CALLS_VOICEMAIL_TYPE); } /** @@ -201,18 +202,31 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { } public void testSetPhoneCallDetails_MultipleCallTypeIcons() { - setPhoneCallDetailsWithCallTypeIcons(Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE); - assertCallTypeIconsEquals(Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE); + setPhoneCallDetailsWithCallTypeIcons( + AppCompatConstants.CALLS_INCOMING_TYPE, + AppCompatConstants.CALLS_OUTGOING_TYPE); + assertCallTypeIconsEquals( + AppCompatConstants.CALLS_INCOMING_TYPE, + AppCompatConstants.CALLS_OUTGOING_TYPE); - setPhoneCallDetailsWithCallTypeIcons(Calls.MISSED_TYPE, Calls.MISSED_TYPE); - assertCallTypeIconsEquals(Calls.MISSED_TYPE, Calls.MISSED_TYPE); + setPhoneCallDetailsWithCallTypeIcons( + AppCompatConstants.CALLS_MISSED_TYPE, + AppCompatConstants.CALLS_MISSED_TYPE); + assertCallTypeIconsEquals( + AppCompatConstants.CALLS_MISSED_TYPE, + AppCompatConstants.CALLS_MISSED_TYPE); } public void testSetPhoneCallDetails_MultipleCallTypeIconsLastOneDropped() { - setPhoneCallDetailsWithCallTypeIcons(Calls.MISSED_TYPE, Calls.MISSED_TYPE, - Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE); + setPhoneCallDetailsWithCallTypeIcons( + AppCompatConstants.CALLS_MISSED_TYPE, + AppCompatConstants.CALLS_MISSED_TYPE, + AppCompatConstants.CALLS_INCOMING_TYPE, + AppCompatConstants.CALLS_OUTGOING_TYPE); assertCallTypeIconsEqualsPlusOverflow("(4)", - Calls.MISSED_TYPE, Calls.MISSED_TYPE, Calls.INCOMING_TYPE); + AppCompatConstants.CALLS_MISSED_TYPE, + AppCompatConstants.CALLS_MISSED_TYPE, + AppCompatConstants.CALLS_INCOMING_TYPE); } public void testSetPhoneCallDetails_Geocode() { @@ -337,7 +351,7 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { private void setPhoneCallDetailsWithNumber(String number, int presentation, String formattedNumber) { PhoneCallDetails details = getPhoneCallDetails(number, presentation, formattedNumber); - details.callTypes = new int[]{ Calls.VOICEMAIL_TYPE }; + details.callTypes = new int[]{ AppCompatConstants.CALLS_VOICEMAIL_TYPE }; mHelper.setPhoneCallDetails(mViews, details); } @@ -406,7 +420,7 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { } private void setDefaultDetails(PhoneCallDetails details) { - details.callTypes = new int[]{ Calls.INCOMING_TYPE }; + details.callTypes = new int[]{ AppCompatConstants.CALLS_INCOMING_TYPE }; details.countryIso = TEST_COUNTRY_ISO; details.date = TEST_DATE; details.duration = TEST_DURATION; diff --git a/tests/src/com/android/dialer/onboard/OnboardingControllerTest.java b/tests/src/com/android/dialer/onboard/OnboardingControllerTest.java index d9c8ce5c0..3ca39a72f 100644 --- a/tests/src/com/android/dialer/onboard/OnboardingControllerTest.java +++ b/tests/src/com/android/dialer/onboard/OnboardingControllerTest.java @@ -17,6 +17,7 @@ package com.android.dialer.onboard; import android.app.Activity; import android.test.AndroidTestCase; +import android.test.suitebuilder.annotation.Suppress; public class OnboardingControllerTest extends AndroidTestCase { private MockOnboardUi mOnboardUi; @@ -68,12 +69,14 @@ public class OnboardingControllerTest extends AndroidTestCase { mController = new OnboardingController(mOnboardUi); } + @Suppress public void testNoScreensToDisplay_OnboardingFlowImmediatelyCompleted() { mController.showNextScreen(); assertEquals(-1, mOnboardUi.currentScreen); assertTrue(mOnboardUi.completedOnboardingFlow); } + @Suppress public void testSkipAllScreens_OnboardingFlowImmediatelyCompleted() { mController.addScreen(new MockScreen(false /* shouldShowScreen */, true /* canSkipScreen */)); @@ -86,6 +89,7 @@ public class OnboardingControllerTest extends AndroidTestCase { assertTrue(mOnboardUi.completedOnboardingFlow); } + @Suppress public void testFirstScreenNotNeeded_ShowsSecondScreen() { mController.addScreen(new MockScreen(false /* shouldShowScreen */, false /* canSkipScreen */)); @@ -95,6 +99,7 @@ public class OnboardingControllerTest extends AndroidTestCase { assertEquals(1, mOnboardUi.currentScreen); } + @Suppress public void testScreenRequired() { final MockScreen mockScreen = new MockScreen(true /* shouldShowScreen */, false /* canSkipScreen */); @@ -128,6 +133,7 @@ public class OnboardingControllerTest extends AndroidTestCase { * For example, setting the default dialer in the first screen will automatically grant * permissions such that the second permissions screen is no longer needed. */ + @Suppress public void testFirstScreenCompleted_SkipsSecondScreen() { final MockScreen mockScreen1 = new MockScreen(true /* shouldShowScreen */, true /* canSkipScreen */); @@ -151,6 +157,7 @@ public class OnboardingControllerTest extends AndroidTestCase { * Verifies the use case where skipping the first screen will proceed to show the second screen * since the necessary conditions to skip the second screen have not been met. */ + @Suppress public void testFirstScreenSkipped_ShowsSecondScreen() { final MockScreen mockScreen1 = new MockScreen(true /* shouldShowScreen */, true /* canSkipScreen */); diff --git a/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java b/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java index e499e550d..ae0dba822 100644 --- a/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java +++ b/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java @@ -57,6 +57,7 @@ import android.widget.TimePicker; import android.widget.Toast; import com.android.dialer.tests.R; +import com.android.dialer.util.AppCompatConstants; import java.util.Calendar; import java.util.List; @@ -72,7 +73,9 @@ public class FillCallLogTestActivity extends Activity { private static final Random RNG = new Random(); private static final int[] CALL_TYPES = new int[] { - Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE, Calls.MISSED_TYPE, + AppCompatConstants.CALLS_INCOMING_TYPE, + AppCompatConstants.CALLS_OUTGOING_TYPE, + AppCompatConstants.CALLS_MISSED_TYPE }; private TextView mNumberTextView; @@ -406,15 +409,15 @@ public class FillCallLogTestActivity extends Activity { */ private int getManualCallType() { if (mCallTypeIncoming.isChecked()) { - return Calls.INCOMING_TYPE; + return AppCompatConstants.CALLS_INCOMING_TYPE; } else if (mCallTypeOutgoing.isChecked()) { - return Calls.OUTGOING_TYPE; + return AppCompatConstants.CALLS_OUTGOING_TYPE; } else if (mCallTypeVoicemail.isChecked()) { - return Calls.VOICEMAIL_TYPE; + return AppCompatConstants.CALLS_VOICEMAIL_TYPE; } else if (mCallTypeCustom.isChecked()) { return Integer.parseInt(mCustomCallTypeTextView.getText().toString()); } else { - return Calls.MISSED_TYPE; + return AppCompatConstants.CALLS_MISSED_TYPE; } } @@ -536,7 +539,7 @@ public class FillCallLogTestActivity extends Activity { dataUsage = (long) RNG.nextInt(52428800); } - if (getManualCallType() == Calls.VOICEMAIL_TYPE) { + if (getManualCallType() == AppCompatConstants.CALLS_VOICEMAIL_TYPE) { addManualVoicemail(dateTime.getTimeInMillis()); } else { addCall(mPhoneNumber.getText().toString(), getManualPresentation(), @@ -606,7 +609,7 @@ public class FillCallLogTestActivity extends Activity { values.put("phone_account_address", accountAddress); values.put(Calls.NEW, Integer.valueOf(1)); - if (callType == Calls.MISSED_TYPE) { + if (callType == AppCompatConstants.CALLS_MISSED_TYPE) { values.put(Calls.IS_READ, 0); } |