diff options
author | Ed Heyl <edheyl@google.com> | 2014-05-29 06:46:56 +0000 |
---|---|---|
committer | Ed Heyl <edheyl@google.com> | 2014-05-29 06:46:56 +0000 |
commit | 8bde324e003a081bf8d83fe28f040c318a4d2165 (patch) | |
tree | 7f62a380281b100e076e8ff9f4fd73ecb1888ce9 /tests/src | |
parent | fabd82363920a24be32d68adb5966412c626dea0 (diff) |
Fix build breakage: Revert "Fix broken Dialer tests"
This reverts commit fabd82363920a24be32d68adb5966412c626dea0.
Change-Id: If65df0d4badc3381f60923a04412f4bec5c36c62
Diffstat (limited to 'tests/src')
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( + "<font color='#33b5e5'><b>Yesterday</b></font>")); } /** 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<Fragme private Random mRnd; + // References to the icons bitmaps used to build the list are stored in a + // map mIcons. The keys to retrieve the icons are: + // Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE and Calls.MISSED_TYPE. + private HashMap<Integer, Bitmap> 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<Fragme mAdapter.stopRequestProcessing(); mParentView = new FrameLayout(mActivity); mCursor = new MatrixCursor(CallLogQuery._PROJECTION); + buildIconMap(); } /** @@ -406,6 +412,17 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme return d.getBitmap(); } + /** + * Fetch all the icons we need in tests from the contacts app and store them in a map. + */ + private void buildIconMap() { + mCallTypeIcons = new HashMap<Integer, Bitmap>(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() { |