summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2015-06-29 16:49:18 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-06-29 16:49:20 +0000
commitbab70c36308ca61950b9b64afe754d9ec2d98b30 (patch)
treec2176b70205c5676fa6ca6222eb0cc4325faae6e /tests
parent33c04aca3b2e68251acdfb9c997b12b8cd06b300 (diff)
parentd3f6a6c56dec7d47bae1121ed1030f67c26736fe (diff)
Merge "Cache repeated Telecom requests from call log." into mnc-dev
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java28
-rw-r--r--tests/src/com/android/dialer/calllog/PhoneCallDetailsHelperTest.java (renamed from tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java)14
-rw-r--r--tests/src/com/android/dialer/calllog/TestTelecomCallLogCache.java (renamed from tests/src/com/android/dialer/calllog/TestPhoneNumberUtilsWrapper.java)4
-rw-r--r--tests/src/com/android/dialer/util/DialerUtilsTest.java2
4 files changed, 24 insertions, 24 deletions
diff --git a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java
index 8ee85a436..8c2d8e443 100644
--- a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java
+++ b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java
@@ -24,7 +24,6 @@ import android.view.View;
import com.android.contacts.common.CallUtil;
import com.android.dialer.PhoneCallDetails;
-import com.android.dialer.PhoneCallDetailsHelper;
import com.android.dialer.R;
/**
@@ -60,12 +59,13 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
super.setUp();
mContext = getContext();
mResources = mContext.getResources();
- final TestPhoneNumberUtilsWrapper phoneUtils =
- new TestPhoneNumberUtilsWrapper(mContext, TEST_VOICEMAIL_NUMBER);
+ final TestTelecomCallLogCache phoneUtils =
+ new TestTelecomCallLogCache(mContext, TEST_VOICEMAIL_NUMBER);
PhoneCallDetailsHelper phoneCallDetailsHelper =
new PhoneCallDetailsHelper(mContext, mResources, phoneUtils);
- mHelper = new CallLogListItemHelper(phoneCallDetailsHelper, mResources);
+ mHelper = new CallLogListItemHelper(phoneCallDetailsHelper, mResources, phoneUtils);
mViewHolder = CallLogListItemViewHolder.createForTest(mContext);
+
}
@Override
@@ -104,13 +104,13 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
public void testSetPhoneCallDetails_ReadVoicemail() {
PhoneCallDetails details = getPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE);
- mHelper.setPhoneCallDetails(getContext(), mViewHolder, details);
+ mHelper.setPhoneCallDetails(mViewHolder, details);
assertEquals(View.VISIBLE, mViewHolder.voicemailPlaybackView.getVisibility());
}
public void testSetPhoneCallDetails_UnreadVoicemail() {
PhoneCallDetails details = getPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE);
- mHelper.setPhoneCallDetails(getContext(), mViewHolder, details);
+ mHelper.setPhoneCallDetails(mViewHolder, details);
assertEquals(View.VISIBLE, mViewHolder.voicemailPlaybackView.getVisibility());
}
@@ -176,7 +176,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
public void testGetCallDescription_NoVoicemailOutgoing() {
PhoneCallDetails details =
getPhoneCallDetailsWithTypes(Calls.OUTGOING_TYPE, Calls.OUTGOING_TYPE);
- CharSequence description = mHelper.getCallDescription(getContext(), details);
+ CharSequence description = mHelper.getCallDescription(details);
assertFalse(description.toString()
.contains(this.mResources.getString(R.string.description_new_voicemail)));
}
@@ -188,7 +188,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
public void testGetCallDescription_NoVoicemailIncoming() {
PhoneCallDetails details =
getPhoneCallDetailsWithTypes(Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE);
- CharSequence description = mHelper.getCallDescription(getContext(), details);
+ CharSequence description = mHelper.getCallDescription(details);
assertFalse(description.toString()
.contains(this.mResources.getString(R.string.description_new_voicemail)));
}
@@ -200,7 +200,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
public void testGetCallDescription_NoVoicemailMissed() {
PhoneCallDetails details =
getPhoneCallDetailsWithTypes(Calls.MISSED_TYPE, Calls.OUTGOING_TYPE);
- CharSequence description = mHelper.getCallDescription(getContext(), details);
+ CharSequence description = mHelper.getCallDescription(details);
assertFalse(description.toString()
.contains(this.mResources.getString(R.string.description_new_voicemail)));
}
@@ -212,7 +212,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
public void testGetCallDescription_Voicemail() {
PhoneCallDetails details =
getPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE, Calls.OUTGOING_TYPE);
- CharSequence description = mHelper.getCallDescription(getContext(), details);
+ CharSequence description = mHelper.getCallDescription(details);
assertTrue(description.toString()
.contains(this.mResources.getString(R.string.description_new_voicemail)));
}
@@ -223,7 +223,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
*/
public void testGetCallDescription_NumCallsSingle() {
PhoneCallDetails details = getPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE);
- CharSequence description = mHelper.getCallDescription(getContext(), details);
+ CharSequence description = mHelper.getCallDescription(details);
// Rather than hard coding the "X calls" string message, we'll generate it with an empty
// number of calls, and trim the resulting string. This gets us just the word "calls",
@@ -240,7 +240,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
public void testGetCallDescription_NumCallsMultiple() {
PhoneCallDetails details =
getPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE, Calls.INCOMING_TYPE);
- CharSequence description = mHelper.getCallDescription(getContext(), details);
+ CharSequence description = mHelper.getCallDescription(details);
assertTrue(description.toString()
.contains(this.mResources.getString(R.string.description_num_calls, 2)));
}
@@ -254,7 +254,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
getPhoneCallDetailsWithTypes(Calls.INCOMING_TYPE, Calls.INCOMING_TYPE);
details.features = Calls.FEATURES_VIDEO;
- CharSequence description = mHelper.getCallDescription(getContext(), details);
+ CharSequence description = mHelper.getCallDescription(details);
final boolean isVideoEnabled = CallUtil.isVideoEnabled(getContext());
assertTrue(description.toString()
.contains(this.mResources.getString(
@@ -284,7 +284,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase {
PhoneCallDetails details = getPhoneCallDetails(
number, presentation, formattedNumber);
details.callTypes = new int[]{ callType };
- mHelper.setPhoneCallDetails(mContext, mViewHolder, details);
+ mHelper.setPhoneCallDetails(mViewHolder, details);
}
private PhoneCallDetails getPhoneCallDetails(
diff --git a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java b/tests/src/com/android/dialer/calllog/PhoneCallDetailsHelperTest.java
index 2ee38cbe5..318250247 100644
--- a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java
+++ b/tests/src/com/android/dialer/calllog/PhoneCallDetailsHelperTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.dialer;
+package com.android.dialer.calllog;
import android.content.Context;
import android.content.res.Resources;
@@ -25,15 +25,15 @@ import android.text.Spanned;
import android.view.View;
import android.widget.TextView;
-import com.android.dialer.calllog.ContactInfo;
-import com.android.dialer.calllog.TestPhoneNumberUtilsWrapper;
+import com.android.dialer.PhoneCallDetails;
+import com.android.dialer.R;
import com.android.dialer.util.LocaleTestUtils;
import java.util.GregorianCalendar;
import java.util.Locale;
/**
- * Unit tests for {@link PhoneCallDetailsHelper}.
+ * Unit tests for {@link PhoneCallDetailsHelper}.m
*/
public class PhoneCallDetailsHelperTest extends AndroidTestCase {
/** The number to be used to access the voicemail. */
@@ -60,7 +60,7 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase {
private PhoneCallDetailsViews mViews;
private TextView mNameView;
private LocaleTestUtils mLocaleTestUtils;
- private TestPhoneNumberUtilsWrapper mPhoneUtils;
+ private TestTelecomCallLogCache mPhoneUtils;
private Context mContext;
@@ -69,8 +69,8 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase {
super.setUp();
mContext = getContext();
Resources resources = mContext.getResources();
- mPhoneUtils = new TestPhoneNumberUtilsWrapper(mContext, TEST_VOICEMAIL_NUMBER);
- final TestPhoneNumberUtilsWrapper phoneUtils = new TestPhoneNumberUtilsWrapper(
+ mPhoneUtils = new TestTelecomCallLogCache(mContext, TEST_VOICEMAIL_NUMBER);
+ final TestTelecomCallLogCache phoneUtils = new TestTelecomCallLogCache(
mContext, TEST_VOICEMAIL_NUMBER);
mHelper = new PhoneCallDetailsHelper(mContext, resources, phoneUtils);
mHelper.setCurrentTimeForTest(
diff --git a/tests/src/com/android/dialer/calllog/TestPhoneNumberUtilsWrapper.java b/tests/src/com/android/dialer/calllog/TestTelecomCallLogCache.java
index 24916db9e..5475ec337 100644
--- a/tests/src/com/android/dialer/calllog/TestPhoneNumberUtilsWrapper.java
+++ b/tests/src/com/android/dialer/calllog/TestTelecomCallLogCache.java
@@ -23,10 +23,10 @@ import android.telecom.PhoneAccountHandle;
* 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 {
+public final class TestTelecomCallLogCache extends TelecomCallLogCache {
private CharSequence mVoicemailNumber;
- public TestPhoneNumberUtilsWrapper(Context context, CharSequence voicemailNumber) {
+ public TestTelecomCallLogCache(Context context, CharSequence voicemailNumber) {
super(context);
mVoicemailNumber = voicemailNumber;
}
diff --git a/tests/src/com/android/dialer/util/DialerUtilsTest.java b/tests/src/com/android/dialer/util/DialerUtilsTest.java
index fdd02c10c..ccd6dfdd5 100644
--- a/tests/src/com/android/dialer/util/DialerUtilsTest.java
+++ b/tests/src/com/android/dialer/util/DialerUtilsTest.java
@@ -16,7 +16,7 @@
package com.android.dialer.util;
-import com.android.dialer.PhoneCallDetailsHelper;
+import com.android.dialer.calllog.PhoneCallDetailsHelper;
import com.google.common.collect.Lists;
import android.content.Context;