Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5c432033 authored by Yorke Lee's avatar Yorke Lee
Browse files

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
parent 76af8945
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper {
    /**
     * SmartDial DB version ranges:
     * <pre>
     *   0-98   KeyLimePie
     *   0-98   KitKat
     * </pre>
     */
    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);
                    }
                }
            }
+3 −5
Original line number Diff line number Diff line
@@ -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,