summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristine Chen <christinech@google.com>2013-08-14 21:44:19 +0200
committerChristine Chen <christinech@google.com>2013-08-15 23:33:49 +0200
commit7030a12a15e565521ffb220c00a0251e47bd3a93 (patch)
tree6e09bf8a541efebdadf6efc3fc959737277f0231 /tests
parentba6b3366f21c47454b3ba5189e94bb6bf58fd11d (diff)
Change primary actions of the CallLog items.
- When the CallLog item is in the CallLog fragment, the primary action remains to be opening the call detail page. - When the CallLog item is in the Favorite fragment, the primary action changes to be calling the number directly. The secondary action is hidden unless it is to play a voicemail. Bug: 10308694 Change-Id: I28ca7aa783bcca35eb8b41f6e8508d08062dd253
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/dialer/calllog/CallLogAdapterTest.java2
-rw-r--r--tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java88
2 files changed, 85 insertions, 5 deletions
diff --git a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java
index 6811371d4..ce862de20 100644
--- a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java
+++ b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java
@@ -212,7 +212,7 @@ public class CallLogAdapterTest extends AndroidTestCase {
public TestCallLogAdapter(Context context, CallFetcher callFetcher,
ContactInfoHelper contactInfoHelper) {
- super(context, callFetcher, contactInfoHelper);
+ super(context, callFetcher, contactInfoHelper, false);
}
@Override
diff --git a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java
index 2cc742359..1b793bc65 100644
--- a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java
+++ b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java
@@ -77,21 +77,42 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
assertEquals(View.VISIBLE, mViews.secondaryActionView.getVisibility());
}
+ public void testSetPhoneCallDetailsInFavorites() {
+ setPhoneCallDetailsWithNumberInFavorites("12125551234", Calls.PRESENTATION_ALLOWED,
+ "1-212-555-1234");
+ assertNoCallButton();
+ }
+
public void testSetPhoneCallDetails_Unknown() {
setPhoneCallDetailsWithNumber("", Calls.PRESENTATION_UNKNOWN, "");
assertNoCallButton();
}
+ public void testSetPhoneCallDetailsInFavorites_Unknown() {
+ setPhoneCallDetailsWithNumberInFavorites("", Calls.PRESENTATION_UNKNOWN, "");
+ assertNoCallButton();
+ }
+
public void testSetPhoneCallDetails_Private() {
setPhoneCallDetailsWithNumber("", Calls.PRESENTATION_RESTRICTED, "");
assertNoCallButton();
}
+ public void testSetPhoneCallDetailsInFavorites_Private() {
+ setPhoneCallDetailsWithNumberInFavorites("", Calls.PRESENTATION_RESTRICTED, "");
+ assertNoCallButton();
+ }
+
public void testSetPhoneCallDetails_Payphone() {
setPhoneCallDetailsWithNumber("", Calls.PRESENTATION_PAYPHONE, "");
assertNoCallButton();
}
+ public void testSetPhoneCallDetailsInFavorites_Payphone() {
+ setPhoneCallDetailsWithNumberInFavorites("", Calls.PRESENTATION_PAYPHONE, "");
+ assertNoCallButton();
+ }
+
public void testSetPhoneCallDetails_VoicemailNumber() {
setPhoneCallDetailsWithNumber(TEST_VOICEMAIL_NUMBER,
Calls.PRESENTATION_ALLOWED, TEST_VOICEMAIL_NUMBER);
@@ -114,6 +135,28 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
assertEquals(View.VISIBLE, mViews.secondaryActionView.getVisibility());
}
+ public void testSetPhoneCallDetailsInFavorites_VoicemailNumber() {
+ setPhoneCallDetailsWithNumberInFavorites(TEST_VOICEMAIL_NUMBER,
+ Calls.PRESENTATION_ALLOWED, TEST_VOICEMAIL_NUMBER);
+ assertNoCallButton();
+ }
+
+ public void testSetPhoneCallDetailsInFavorites_ReadVoicemail() {
+ setPhoneCallDetailsWithTypesInFavorites(Calls.VOICEMAIL_TYPE);
+ assertEquals(View.VISIBLE, mViews.secondaryActionView.getVisibility());
+ }
+
+ public void testSetPhoneCallDetailsInFavorites_UnreadVoicemail() {
+ setUnreadPhoneCallDetailsWithTypesInFavorites(Calls.VOICEMAIL_TYPE);
+ assertEquals(View.VISIBLE, mViews.secondaryActionView.getVisibility());
+ }
+
+ public void testSetPhoneCallDetailsInFavorites_VoicemailFromUnknown() {
+ setPhoneCallDetailsWithNumberAndTypeInFavorites("", Calls.PRESENTATION_UNKNOWN,
+ "", Calls.VOICEMAIL_TYPE);
+ assertEquals(View.VISIBLE, mViews.secondaryActionView.getVisibility());
+ }
+
/** Asserts that the whole call area is gone. */
private void assertNoCallButton() {
assertEquals(View.GONE, mViews.secondaryActionView.getVisibility());
@@ -126,6 +169,13 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
formattedNumber, Calls.INCOMING_TYPE);
}
+ /** Sets the details of a phone call in the favorite screen using the specified phone number. */
+ private void setPhoneCallDetailsWithNumberInFavorites(String number,
+ int presentation, String formattedNumber) {
+ setPhoneCallDetailsWithNumberAndTypeInFavorites(number, presentation,
+ formattedNumber, Calls.INCOMING_TYPE);
+ }
+
/** Sets the details of a phone call using the specified phone number. */
private void setPhoneCallDetailsWithNumberAndType(String number,
int presentation, String formattedNumber, int callType) {
@@ -133,7 +183,17 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
new PhoneCallDetails(number, presentation, formattedNumber,
TEST_COUNTRY_ISO, TEST_GEOCODE,
new int[]{ callType }, TEST_DATE, TEST_DURATION),
- false);
+ false, false);
+ }
+
+ /** Sets the details of a phone call in the favorite screen using the specified phone number. */
+ private void setPhoneCallDetailsWithNumberAndTypeInFavorites(String number,
+ int presentation, String formattedNumber, int callType) {
+ mHelper.setPhoneCallDetails(mViews,
+ new PhoneCallDetails(number, presentation, formattedNumber,
+ TEST_COUNTRY_ISO, TEST_GEOCODE,
+ new int[]{ callType }, TEST_DATE, TEST_DURATION),
+ false, true);
}
/** Sets the details of a phone call using the specified call type. */
@@ -142,15 +202,35 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED,
TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE,
types, TEST_DATE, TEST_DURATION),
- false);
+ false, false);
}
- /** Sets the details of a phone call using the specified call type. */
+ /** Sets the details of a phone call in the favorite screen using the specified call type. */
+ private void setPhoneCallDetailsWithTypesInFavorites(int... types) {
+ mHelper.setPhoneCallDetails(mViews,
+ new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED,
+ TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE,
+ types, TEST_DATE, TEST_DURATION),
+ false, true);
+ }
+
+ /** Sets the details of an unread phone call using the specified call type. */
private void setUnreadPhoneCallDetailsWithTypes(int... types) {
mHelper.setPhoneCallDetails(mViews,
new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED,
TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE,
types, TEST_DATE, TEST_DURATION),
- true);
+ true, false);
+ }
+
+ /** Sets the details of an unread phone call in the favorite screen using the specified call
+ * type.
+ */
+ private void setUnreadPhoneCallDetailsWithTypesInFavorites(int... types) {
+ mHelper.setPhoneCallDetails(mViews,
+ new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED,
+ TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE,
+ types, TEST_DATE, TEST_DURATION),
+ true, true);
}
}