diff options
author | Christine Chen <christinech@google.com> | 2013-07-02 18:11:18 -0700 |
---|---|---|
committer | Christine Chen <christinech@google.com> | 2013-07-03 10:35:44 -0700 |
commit | f517e7bb367d1ed749b500959d0a0a1ba8c3d5e5 (patch) | |
tree | 34d8b156d517080447f96d8836afc6a595d5bb6c /tests | |
parent | 9d28cc4b92fac8cbbebbbb9adddd529c50b2545d (diff) |
Remove CallLog New and Old sectioning.
Bug: <5751629>
Change-Id: I1689fa10f285bc66fc69b6a9b9da139ce5461d83
Diffstat (limited to 'tests')
4 files changed, 22 insertions, 76 deletions
diff --git a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java index 6ec3e76ef..6811371d4 100644 --- a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java @@ -65,7 +65,7 @@ public class CallLogAdapterTest extends AndroidTestCase { mAdapter = new TestCallLogAdapter(getContext(), fakeCallFetcher, fakeContactInfoHelper); // The cursor used in the tests to store the entries to display. - mCursor = new MatrixCursor(CallLogQuery.EXTENDED_PROJECTION); + mCursor = new MatrixCursor(CallLogQuery._PROJECTION); mCursor.moveToFirst(); // The views into which to store the data. mView = new View(getContext()); @@ -172,7 +172,7 @@ public class CallLogAdapterTest extends AndroidTestCase { /** Returns a call log entry without cached values. */ private Object[] createCallLogEntry() { - Object[] values = CallLogQueryTestUtils.createTestExtendedValues(); + Object[] values = CallLogQueryTestUtils.createTestValues(); values[CallLogQuery.NUMBER] = TEST_NUMBER; values[CallLogQuery.COUNTRY_ISO] = TEST_COUNTRY_ISO; return values; diff --git a/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java b/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java index c94f8d9ac..c9055ca81 100644 --- a/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java @@ -126,7 +126,7 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme mAdapter.disableRequestProcessingForTest(); mAdapter.stopRequestProcessing(); mParentView = new FrameLayout(mActivity); - mCursor = new MatrixCursor(CallLogQuery.EXTENDED_PROJECTION); + mCursor = new MatrixCursor(CallLogQuery._PROJECTION); buildIconMap(); } @@ -515,7 +515,7 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme */ private Object[] getValuesToInsert(String number, int presentation, long date, int duration, int type) { - Object[] values = CallLogQueryTestUtils.createTestExtendedValues(); + Object[] values = CallLogQueryTestUtils.createTestValues(); values[CallLogQuery.ID] = mIndex; values[CallLogQuery.NUMBER] = number; values[CallLogQuery.NUMBER_PRESENTATION] = presentation; @@ -526,7 +526,6 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme } values[CallLogQuery.CALL_TYPE] = type; values[CallLogQuery.COUNTRY_ISO] = TEST_COUNTRY_ISO; - values[CallLogQuery.SECTION] = CallLogQuery.SECTION_OLD_ITEM; return values; } diff --git a/tests/src/com/android/dialer/calllog/CallLogGroupBuilderTest.java b/tests/src/com/android/dialer/calllog/CallLogGroupBuilderTest.java index 6c20afe1d..cef717f00 100644 --- a/tests/src/com/android/dialer/calllog/CallLogGroupBuilderTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogGroupBuilderTest.java @@ -64,49 +64,36 @@ public class CallLogGroupBuilderTest extends AndroidTestCase { } public void testAddGroups_OneCall() { - addOldCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE); + addCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE); mBuilder.addGroups(mCursor); assertEquals(0, mFakeGroupCreator.groups.size()); } public void testAddGroups_TwoCallsNotMatching() { - addOldCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE); - addOldCallLogEntry(TEST_NUMBER2, Calls.INCOMING_TYPE); + addCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE); + addCallLogEntry(TEST_NUMBER2, Calls.INCOMING_TYPE); mBuilder.addGroups(mCursor); assertEquals(0, mFakeGroupCreator.groups.size()); } public void testAddGroups_ThreeCallsMatching() { - addOldCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE); - addOldCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE); - addOldCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE); + addCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE); + addCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE); + addCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE); mBuilder.addGroups(mCursor); assertEquals(1, mFakeGroupCreator.groups.size()); assertGroupIs(0, 3, false, mFakeGroupCreator.groups.get(0)); } public void testAddGroups_MatchingIncomingAndOutgoing() { - addOldCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE); - addOldCallLogEntry(TEST_NUMBER1, Calls.OUTGOING_TYPE); - addOldCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE); + addCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE); + addCallLogEntry(TEST_NUMBER1, Calls.OUTGOING_TYPE); + addCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE); mBuilder.addGroups(mCursor); assertEquals(1, mFakeGroupCreator.groups.size()); assertGroupIs(0, 3, false, mFakeGroupCreator.groups.get(0)); } - public void testAddGroups_HeaderSplitsGroups() { - addNewCallLogHeader(); - addNewCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE); - addNewCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE); - addOldCallLogHeader(); - addOldCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE); - addOldCallLogEntry(TEST_NUMBER1, Calls.INCOMING_TYPE); - mBuilder.addGroups(mCursor); - assertEquals(2, mFakeGroupCreator.groups.size()); - assertGroupIs(1, 2, false, mFakeGroupCreator.groups.get(0)); - assertGroupIs(4, 2, false, mFakeGroupCreator.groups.get(1)); - } - public void testAddGroups_Voicemail() { // Does not group with other types of calls, include voicemail themselves. assertCallsAreNotGrouped(Calls.VOICEMAIL_TYPE, Calls.MISSED_TYPE); @@ -149,7 +136,7 @@ public class CallLogGroupBuilderTest extends AndroidTestCase { } public void testAddGroups_Mixed() { - addMultipleOldCallLogEntries(TEST_NUMBER1, + addMultipleCallLogEntries(TEST_NUMBER1, Calls.VOICEMAIL_TYPE, // Stand-alone Calls.INCOMING_TYPE, // Group 1: 1-4 Calls.OUTGOING_TYPE, @@ -226,7 +213,7 @@ public class CallLogGroupBuilderTest extends AndroidTestCase { /** Creates (or recreates) the cursor used to store the call log content for the tests. */ private void createCursor() { - mCursor = new MatrixCursor(CallLogQuery.EXTENDED_PROJECTION); + mCursor = new MatrixCursor(CallLogQuery._PROJECTION); } /** Clears the content of the {@link FakeGroupCreator} used in the tests. */ @@ -238,7 +225,7 @@ public class CallLogGroupBuilderTest extends AndroidTestCase { private void assertCallsAreGrouped(int... types) { createCursor(); clearFakeGroupCreator(); - addMultipleOldCallLogEntries(TEST_NUMBER1, types); + addMultipleCallLogEntries(TEST_NUMBER1, types); mBuilder.addGroups(mCursor); assertEquals(1, mFakeGroupCreator.groups.size()); assertGroupIs(0, types.length, false, mFakeGroupCreator.groups.get(0)); @@ -249,63 +236,32 @@ public class CallLogGroupBuilderTest extends AndroidTestCase { private void assertCallsAreNotGrouped(int... types) { createCursor(); clearFakeGroupCreator(); - addMultipleOldCallLogEntries(TEST_NUMBER1, types); + addMultipleCallLogEntries(TEST_NUMBER1, types); mBuilder.addGroups(mCursor); assertEquals(0, mFakeGroupCreator.groups.size()); } /** Adds a set of calls with the given types, all from the same number, in the old section. */ - private void addMultipleOldCallLogEntries(String number, int... types) { + private void addMultipleCallLogEntries(String number, int... types) { for (int type : types) { - addOldCallLogEntry(number, type); + addCallLogEntry(number, type); } } - - /** Adds a call with the given number and type to the old section of the call log. */ - private void addOldCallLogEntry(String number, int type) { - addCallLogEntry(number, type, CallLogQuery.SECTION_OLD_ITEM); - } - - /** Adds a call with the given number and type to the new section of the call log. */ - private void addNewCallLogEntry(String number, int type) { - addCallLogEntry(number, type, CallLogQuery.SECTION_NEW_ITEM); - } - /** Adds a call log entry with the given number and type to the cursor. */ - private void addCallLogEntry(String number, int type, int section) { - if (section != CallLogQuery.SECTION_NEW_ITEM - && section != CallLogQuery.SECTION_OLD_ITEM) { - throw new IllegalArgumentException("not an item section: " + section); - } + private void addCallLogEntry(String number, int type) { mCursor.moveToNext(); - Object[] values = CallLogQueryTestUtils.createTestExtendedValues(); + Object[] values = CallLogQueryTestUtils.createTestValues(); values[CallLogQuery.ID] = mCursor.getPosition(); values[CallLogQuery.NUMBER] = number; values[CallLogQuery.CALL_TYPE] = type; - values[CallLogQuery.SECTION] = section; mCursor.addRow(values); } - /** Adds the old section header to the call log. */ - private void addOldCallLogHeader() { - addCallLogHeader(CallLogQuery.SECTION_OLD_HEADER); - } - - /** Adds the new section header to the call log. */ - private void addNewCallLogHeader() { - addCallLogHeader(CallLogQuery.SECTION_NEW_HEADER); - } - /** Adds a call log entry with a header to the cursor. */ private void addCallLogHeader(int section) { - if (section != CallLogQuery.SECTION_NEW_HEADER - && section != CallLogQuery.SECTION_OLD_HEADER) { - throw new IllegalArgumentException("not a header section: " + section); - } mCursor.moveToNext(); - Object[] values = CallLogQueryTestUtils.createTestExtendedValues(); + Object[] values = CallLogQueryTestUtils.createTestValues(); values[CallLogQuery.ID] = mCursor.getPosition(); - values[CallLogQuery.SECTION] = section; mCursor.addRow(values); } diff --git a/tests/src/com/android/dialer/calllog/CallLogQueryTestUtils.java b/tests/src/com/android/dialer/calllog/CallLogQueryTestUtils.java index 52b3b5d4f..c13b936e5 100644 --- a/tests/src/com/android/dialer/calllog/CallLogQueryTestUtils.java +++ b/tests/src/com/android/dialer/calllog/CallLogQueryTestUtils.java @@ -34,13 +34,4 @@ public class CallLogQueryTestUtils { assertEquals(CallLogQuery._PROJECTION.length, values.length); return values; } - - public static Object[] createTestExtendedValues() { - Object[] values = new Object[]{ - 0L, "", 0L, 0L, Calls.INCOMING_TYPE, "", "", "", null, 0, null, null, null, null, - 0L, null, 1, Calls.PRESENTATION_ALLOWED, CallLogQuery.SECTION_OLD_ITEM - }; - Assert.assertEquals(CallLogQuery.EXTENDED_PROJECTION.length, values.length); - return values; - } } |