From 17df9323e45ae5984b6df25b788a9cbffb51e8ab Mon Sep 17 00:00:00 2001 From: Brandon Maxwell Date: Thu, 10 Mar 2016 19:42:44 -0800 Subject: Removing hardcoded database column name + We were previously hardcoding the post_dial_digits column name. This code was written before we had src-N and src-pre-N folders. + This CL converts the hard coded column name to follow the pattern we have for new stuff in the SDK. + Additionally, this CL removes an unneeded method which checks the SDK version, instead using the CompatUtils class. Bug: 25021389 Change-Id: I017d47f7efd323254e616a64d7ac824c5cfb8902 --- tests/src/com/android/dialer/calllog/CallLogAdapterTest.java | 12 +++++++----- .../com/android/dialer/calllog/CallLogGroupBuilderTest.java | 5 +++-- .../com/android/dialer/calllog/CallLogQueryTestUtils.java | 4 +++- 3 files changed, 13 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java index e80131140..f6ef7ef22 100644 --- a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java @@ -16,6 +16,8 @@ package com.android.dialer.calllog; +import com.google.common.collect.Lists; + import android.content.ContentUris; import android.content.Context; import android.content.Intent; @@ -29,12 +31,12 @@ import android.test.suitebuilder.annotation.MediumTest; import android.text.TextUtils; import android.view.View; +import com.android.contacts.common.compat.CompatUtils; import com.android.contacts.common.preference.ContactsPreferences; import com.android.dialer.contactinfo.ContactInfoCache; import com.android.dialer.database.VoicemailArchiveContract; import com.android.dialer.util.AppCompatConstants; import com.android.dialer.util.TestConstants; -import com.google.common.collect.Lists; import java.util.Date; import java.util.List; @@ -235,7 +237,7 @@ public class CallLogAdapterTest extends AndroidTestCase { mAdapter.changeCursor(mCursor); mAdapter.onBindViewHolder(mViewHolder, 0); - if (PhoneNumberDisplayUtil.canShowPostDial()) { + if (CompatUtils.isNCompatible()) { assertHasCallActionToGivenNumber(mViewHolder, TEST_NUMBER + TEST_POST_DIAL_DIGITS); } } @@ -259,7 +261,7 @@ public class CallLogAdapterTest extends AndroidTestCase { mAdapter.changeCursor(mCursor); mAdapter.onBindViewHolder(mViewHolder, 0); - if (PhoneNumberDisplayUtil.canShowPostDial()) { + if (CompatUtils.isNCompatible()) { assertNameIs(mViewHolder, TEST_NUMBER + TEST_POST_DIAL_DIGITS); } } @@ -273,7 +275,7 @@ public class CallLogAdapterTest extends AndroidTestCase { mAdapter.changeCursor(mCursor); mAdapter.onBindViewHolder(mViewHolder, 0); - if (PhoneNumberDisplayUtil.canShowPostDial()) { + if (CompatUtils.isNCompatible()) { assertNameIs(mViewHolder, TEST_CACHED_NAME_PRIMARY); } } @@ -673,7 +675,7 @@ public class CallLogAdapterTest extends AndroidTestCase { if (!TextUtils.isEmpty(number)) { values[CallLogQuery.NUMBER] = number; } - if (!TextUtils.isEmpty(postDialDigits) && PhoneNumberDisplayUtil.canShowPostDial()) { + if (!TextUtils.isEmpty(postDialDigits) && CompatUtils.isNCompatible()) { 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 c31c38e1d..107cf7562 100644 --- a/tests/src/com/android/dialer/calllog/CallLogGroupBuilderTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogGroupBuilderTest.java @@ -22,6 +22,7 @@ import android.database.MatrixCursor; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; +import com.android.contacts.common.compat.CompatUtils; import com.android.dialer.util.AppCompatConstants; import java.util.List; @@ -98,7 +99,7 @@ public class CallLogGroupBuilderTest extends AndroidTestCase { mBuilder.addGroups(mCursor); - if (PhoneNumberDisplayUtil.canShowPostDial()) { + if (CompatUtils.isNCompatible()) { assertEquals(2, mFakeGroupCreator.groups.size()); assertGroupIs(0, 2, mFakeGroupCreator.groups.get(0)); assertGroupIs(2, 1, mFakeGroupCreator.groups.get(1)); @@ -380,7 +381,7 @@ public class CallLogGroupBuilderTest extends AndroidTestCase { values[CallLogQuery.ID] = mCursor.getPosition(); values[CallLogQuery.NUMBER] = number; values[CallLogQuery.CALL_TYPE] = type; - if (PhoneNumberDisplayUtil.canShowPostDial()) { + if (CompatUtils.isNCompatible()) { values[CallLogQuery.POST_DIAL_DIGITS] = postDialDigits; } mCursor.addRow(values); diff --git a/tests/src/com/android/dialer/calllog/CallLogQueryTestUtils.java b/tests/src/com/android/dialer/calllog/CallLogQueryTestUtils.java index 1e4a00000..f1b1a9ab9 100644 --- a/tests/src/com/android/dialer/calllog/CallLogQueryTestUtils.java +++ b/tests/src/com/android/dialer/calllog/CallLogQueryTestUtils.java @@ -20,13 +20,15 @@ import static junit.framework.Assert.assertEquals; import android.provider.CallLog.Calls; +import com.android.contacts.common.compat.CompatUtils; + /** * Helper class to create test values for {@link CallLogQuery}. */ public class CallLogQueryTestUtils { public static Object[] createTestValues() { Object[] values; - if (PhoneNumberDisplayUtil.canShowPostDial()) { + if (CompatUtils.isNCompatible()) { values = new Object[]{ 0L, "", 0L, 0L, Calls.INCOMING_TYPE, "", "", "", null, 0, null, null, null, null, 0L, null, 0, Calls.PRESENTATION_ALLOWED, null, null, 0, null, null, -- cgit v1.2.3