diff options
author | Yorke Lee <yorkelee@google.com> | 2014-05-28 17:47:33 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2014-05-29 07:17:49 -0700 |
commit | e38e9ab6195950d2083efde283788b91d03354c4 (patch) | |
tree | ea3d76eaa4e7323368c5a56908f4949eb5c02eb0 /tests/src/com/android/dialer/database | |
parent | 9495a1d3c98f54606122862d4ab4e5327aac0b72 (diff) |
Fix broken Dialer tests
Remove unneeded use of resources
Instantiate CallLogListItemViews correctly
Add dummy number to SmartDialPrefixTests
Change-Id: I417f54329f43d53e24c4ab6cc65d08d05b5dd6a1
Diffstat (limited to 'tests/src/com/android/dialer/database')
-rw-r--r-- | tests/src/com/android/dialer/database/SmartDialPrefixTest.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/src/com/android/dialer/database/SmartDialPrefixTest.java b/tests/src/com/android/dialer/database/SmartDialPrefixTest.java index 558be265b..9cb842e56 100644 --- a/tests/src/com/android/dialer/database/SmartDialPrefixTest.java +++ b/tests/src/com/android/dialer/database/SmartDialPrefixTest.java @@ -21,6 +21,8 @@ import android.database.sqlite.SQLiteDatabase; import android.test.suitebuilder.annotation.SmallTest; import android.test.suitebuilder.annotation.Suppress; import android.test.AndroidTestCase; +import android.text.TextUtils; +import android.util.Log; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Data; @@ -37,7 +39,7 @@ import java.util.ArrayList; /** * To run this test, use the command: - * adb shell am instrument -w -e class com.android.dialer.dialpad.SmartDialPrefixTest / + * adb shell am instrument -w -e class com.android.dialer.database.SmartDialPrefixTest / * com.android.dialer.tests/android.test.InstrumentationTestRunner */ @SmallTest @@ -145,6 +147,12 @@ public class SmartDialPrefixTest extends AndroidTestCase { assertNotNull(contactCursor); assertNotNull(nameCursor); + if (TextUtils.isEmpty(number)) { + // Add a dummy number, otherwise DialerDatabaseHelper simply ignores the entire + // row if the number is empty + number = "0"; + } + contactCursor.addRow(new Object[]{id, "", "", number, contactId, lookupKey, displayName, photoId, lastTimeUsed, timesUsed, starred, isSuperPrimary, inVisibleGroup, isPrimary}); @@ -292,7 +300,8 @@ public class SmartDialPrefixTest extends AndroidTestCase { // 6543 doesn't match assertFalse(getLooseMatchesFromDb("6543").contains(martinjuniorharry)); - assertEquals(7, mTestHelper.countPrefixTableRows(db)); + // 7 actual rows, + 1 for the dummy number we added + assertEquals(8, mTestHelper.countPrefixTableRows(db)); } public void testPutForInitialMatchesForLongTokenNames() { |