From 5c432033aed8c083f225b79c49c570d2b24618c1 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Fri, 22 Nov 2013 11:16:54 -0800 Subject: Fix Smart dialing tests Test contacts were being created without unique contact ids and lookup keys, causing them to be mistakenly identified as duplicates. Bug: 10346442 Change-Id: I47fd5bdae83346b6b2f620d7abe49326b1cfd23d --- src/com/android/dialer/database/DialerDatabaseHelper.java | 4 ++-- tests/src/com/android/dialer/database/SmartDialPrefixTest.java | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/com/android/dialer/database/DialerDatabaseHelper.java b/src/com/android/dialer/database/DialerDatabaseHelper.java index b9e4b9a90..555c1715c 100644 --- a/src/com/android/dialer/database/DialerDatabaseHelper.java +++ b/src/com/android/dialer/database/DialerDatabaseHelper.java @@ -69,7 +69,7 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper { /** * SmartDial DB version ranges: *
-     *   0-98   KeyLimePie
+     *   0-98   KitKat
      * 
*/ public static final int DATABASE_VERSION = 4; @@ -959,7 +959,7 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper { photoId)); counter++; if (DEBUG) { - stopWatch.lap("Added one result"); + stopWatch.lap("Added one result: Name: " + displayName); } } } diff --git a/tests/src/com/android/dialer/database/SmartDialPrefixTest.java b/tests/src/com/android/dialer/database/SmartDialPrefixTest.java index 23bda7cb2..558be265b 100644 --- a/tests/src/com/android/dialer/database/SmartDialPrefixTest.java +++ b/tests/src/com/android/dialer/database/SmartDialPrefixTest.java @@ -31,13 +31,10 @@ import com.android.dialer.dialpad.SmartDialNameMatcher; import com.android.dialer.dialpad.SmartDialPrefix; import java.lang.Exception; -import java.lang.FindBugsSuppressWarnings; import java.lang.Override; import java.lang.String; import java.util.ArrayList; -import junit.framework.TestCase; - /** * To run this test, use the command: * adb shell am instrument -w -e class com.android.dialer.dialpad.SmartDialPrefixTest / @@ -80,6 +77,7 @@ public class SmartDialPrefixTest extends AndroidTestCase { assertTrue(SmartDialPrefix.isCountryNanp("vi")); } + @Override protected void setUp() { mTestHelper = DialerDatabaseHelper.getNewInstanceForTest(getContext()); } @@ -136,8 +134,8 @@ public class SmartDialPrefixTest extends AndroidTestCase { private ContactNumber constructNewContactWithDummyIds(MatrixCursor contactCursor, MatrixCursor nameCursor, String number, int id, String displayName) { - return constructNewContact(contactCursor, nameCursor, id, number, 0, "", displayName, 0, 0, - 0, 0, 0, 0, 0); + return constructNewContact(contactCursor, nameCursor, id, number, id, String.valueOf(id), + displayName, 0, 0, 0, 0, 0, 0, 0); } private ContactNumber constructNewContact(MatrixCursor contactCursor, MatrixCursor nameCursor, -- cgit v1.2.3