diff options
author | Hall Liu <hallliu@google.com> | 2015-12-01 10:35:21 -0800 |
---|---|---|
committer | Hall Liu <hallliu@google.com> | 2015-12-01 11:55:39 -0800 |
commit | b2e474522fb943a1703875ca45e9cb2b0a303f63 (patch) | |
tree | 4a9a7aa328b5186d79b39bd21fc7185b2ab91ebe /tests/src/com/android | |
parent | 385cda4523c396e49f1ef3acc04107147bcecde6 (diff) |
Add checks for post-dial functionality to avoid breaking tests
Bug: 25929524
Change-Id: I21b00d18e06960add576f8f3a2d01583abadaa17
Diffstat (limited to 'tests/src/com/android')
-rw-r--r-- | tests/src/com/android/dialer/calllog/CallLogAdapterTest.java | 14 | ||||
-rw-r--r-- | tests/src/com/android/dialer/calllog/CallLogGroupBuilderTest.java | 15 |
2 files changed, 21 insertions, 8 deletions
diff --git a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java index 12ae78538..80dfe3578 100644 --- a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java @@ -240,7 +240,9 @@ public class CallLogAdapterTest extends AndroidTestCase { mAdapter.changeCursor(mCursor); mAdapter.onBindViewHolder(mViewHolder, 0); - assertHasCallActionToGivenNumber(mViewHolder, TEST_NUMBER + TEST_POST_DIAL_DIGITS); + if (PhoneNumberDisplayUtil.canShowPostDial()) { + assertHasCallActionToGivenNumber(mViewHolder, TEST_NUMBER + TEST_POST_DIAL_DIGITS); + } } @MediumTest @@ -262,7 +264,9 @@ public class CallLogAdapterTest extends AndroidTestCase { mAdapter.changeCursor(mCursor); mAdapter.onBindViewHolder(mViewHolder, 0); - assertNameIs(mViewHolder, TEST_NUMBER + TEST_POST_DIAL_DIGITS); + if (PhoneNumberDisplayUtil.canShowPostDial()) { + assertNameIs(mViewHolder, TEST_NUMBER + TEST_POST_DIAL_DIGITS); + } } @MediumTest @@ -274,7 +278,9 @@ public class CallLogAdapterTest extends AndroidTestCase { mAdapter.changeCursor(mCursor); mAdapter.onBindViewHolder(mViewHolder, 0); - assertNameIs(mViewHolder, TEST_CACHED_NAME_PRIMARY); + if (PhoneNumberDisplayUtil.canShowPostDial()) { + assertNameIs(mViewHolder, TEST_CACHED_NAME_PRIMARY); + } } @MediumTest @@ -655,7 +661,7 @@ public class CallLogAdapterTest extends AndroidTestCase { if (!TextUtils.isEmpty(number)) { values[CallLogQuery.NUMBER] = number; } - if (!TextUtils.isEmpty(postDialDigits)) { + if (!TextUtils.isEmpty(postDialDigits) && PhoneNumberDisplayUtil.canShowPostDial()) { values[CallLogQuery.POST_DIAL_DIGITS] = postDialDigits; } if (presentation != NO_VALUE_SET) { diff --git a/tests/src/com/android/dialer/calllog/CallLogGroupBuilderTest.java b/tests/src/com/android/dialer/calllog/CallLogGroupBuilderTest.java index fa18afff5..04463c230 100644 --- a/tests/src/com/android/dialer/calllog/CallLogGroupBuilderTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogGroupBuilderTest.java @@ -98,9 +98,14 @@ public class CallLogGroupBuilderTest extends AndroidTestCase { mBuilder.addGroups(mCursor); - assertEquals(2, mFakeGroupCreator.groups.size()); - assertGroupIs(0, 2, mFakeGroupCreator.groups.get(0)); - assertGroupIs(2, 1, mFakeGroupCreator.groups.get(1)); + if (PhoneNumberDisplayUtil.canShowPostDial()) { + assertEquals(2, mFakeGroupCreator.groups.size()); + assertGroupIs(0, 2, mFakeGroupCreator.groups.get(0)); + assertGroupIs(2, 1, mFakeGroupCreator.groups.get(1)); + } else { + assertEquals(1, mFakeGroupCreator.groups.size()); + assertGroupIs(0, 3, mFakeGroupCreator.groups.get(0)); + } } public void testAddGroups_MatchingIncomingAndOutgoing() { @@ -339,7 +344,9 @@ public class CallLogGroupBuilderTest extends AndroidTestCase { values[CallLogQuery.ID] = mCursor.getPosition(); values[CallLogQuery.NUMBER] = number; values[CallLogQuery.CALL_TYPE] = type; - values[CallLogQuery.POST_DIAL_DIGITS] = postDialDigits; + if (PhoneNumberDisplayUtil.canShowPostDial()) { + values[CallLogQuery.POST_DIAL_DIGITS] = postDialDigits; + } mCursor.addRow(values); } |