From 8bde324e003a081bf8d83fe28f040c318a4d2165 Mon Sep 17 00:00:00 2001 From: Ed Heyl Date: Thu, 29 May 2014 06:46:56 +0000 Subject: Fix build breakage: Revert "Fix broken Dialer tests" This reverts commit fabd82363920a24be32d68adb5966412c626dea0. Change-Id: If65df0d4badc3381f60923a04412f4bec5c36c62 --- .../com/android/dialer/PhoneCallDetailsHelperTest.java | 2 ++ .../com/android/dialer/calllog/CallLogAdapterTest.java | 2 +- .../com/android/dialer/calllog/CallLogFragmentTest.java | 17 +++++++++++++++++ .../android/dialer/database/SmartDialPrefixTest.java | 13 ++----------- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java index 679335e57..30fd0e2a7 100644 --- a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java +++ b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java @@ -112,6 +112,8 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { setPhoneCallDetailsWithNumber("14125551212", Calls.PRESENTATION_ALLOWED, "1-412-555-1212"); assertTrue(mViews.callLocationAndDate.getText().toString().contains("Yesterday")); + assertTrue(mViews.callLocationAndDate.getText().toString().contains( + "Yesterday")); } /** Asserts that a char sequence is actually a Spanned corresponding to the expected HTML. */ diff --git a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java index f3679d4ed..8225d1319 100644 --- a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java @@ -68,7 +68,7 @@ public class CallLogAdapterTest extends AndroidTestCase { mCursor = new MatrixCursor(CallLogQuery._PROJECTION); mCursor.moveToFirst(); // The views into which to store the data. - mView = new CallLogListItemView(getContext()); + mView = new View(getContext()); mView.setTag(CallLogListItemViews.createForTest(getContext())); } diff --git a/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java b/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java index 964d8a299..2c0fe0e23 100644 --- a/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java @@ -91,6 +91,11 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2 mCallTypeIcons; + // An item in the call list. All the methods performing checks use it. private CallLogListItemViews mItem; // The list of views representing the data in the DB. View are in @@ -128,6 +133,7 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2(3); + + mCallTypeIcons.put(Calls.INCOMING_TYPE, getBitmap("ic_call_incoming_holo_dark")); + mCallTypeIcons.put(Calls.MISSED_TYPE, getBitmap("ic_call_missed_holo_dark")); + mCallTypeIcons.put(Calls.OUTGOING_TYPE, getBitmap("ic_call_outgoing_holo_dark")); + } + // // HELPERS to build/update the call entries (views) from the DB. // diff --git a/tests/src/com/android/dialer/database/SmartDialPrefixTest.java b/tests/src/com/android/dialer/database/SmartDialPrefixTest.java index 9cb842e56..558be265b 100644 --- a/tests/src/com/android/dialer/database/SmartDialPrefixTest.java +++ b/tests/src/com/android/dialer/database/SmartDialPrefixTest.java @@ -21,8 +21,6 @@ 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; @@ -39,7 +37,7 @@ import java.util.ArrayList; /** * To run this test, use the command: - * adb shell am instrument -w -e class com.android.dialer.database.SmartDialPrefixTest / + * adb shell am instrument -w -e class com.android.dialer.dialpad.SmartDialPrefixTest / * com.android.dialer.tests/android.test.InstrumentationTestRunner */ @SmallTest @@ -147,12 +145,6 @@ 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}); @@ -300,8 +292,7 @@ public class SmartDialPrefixTest extends AndroidTestCase { // 6543 doesn't match assertFalse(getLooseMatchesFromDb("6543").contains(martinjuniorharry)); - // 7 actual rows, + 1 for the dummy number we added - assertEquals(8, mTestHelper.countPrefixTableRows(db)); + assertEquals(7, mTestHelper.countPrefixTableRows(db)); } public void testPutForInitialMatchesForLongTokenNames() { -- cgit v1.2.3