From 427566a204903098de1b7866d25f711918bb28d9 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Tue, 9 Jun 2015 14:29:05 -0700 Subject: Fix CallLogFragment UnitTests. Run "changeCursor" on the main thread. I'm not precisely sure why this fixes things, but it appeared before that the data I had on my local device was being used instead of the test data. Bug: 21471763 Change-Id: I6bece02e7c6828d54f76b5221ad10cf8f0052aa9 --- src/com/android/dialer/calllog/GroupingListAdapter.java | 14 -------------- .../com/android/dialer/calllog/CallLogFragmentTest.java | 10 ++++++++-- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/com/android/dialer/calllog/GroupingListAdapter.java b/src/com/android/dialer/calllog/GroupingListAdapter.java index 501e88df0..8d3ab4545 100644 --- a/src/com/android/dialer/calllog/GroupingListAdapter.java +++ b/src/com/android/dialer/calllog/GroupingListAdapter.java @@ -253,7 +253,6 @@ abstract class GroupingListAdapter extends RecyclerView.Adapter { * corresponding cursor position. */ public void obtainPositionMetadata(PositionMetadata metadata, int position) { - // If the description object already contains requested information, just return if (metadata.listPosition == position) { return; @@ -433,17 +432,4 @@ abstract class GroupingListAdapter extends RecyclerView.Adapter { return -1; } } - - /** - * Used for setting the cursor without triggering a UI thread update. - */ - @NeededForTesting - public void setCursorForTesting(Cursor cursor) { - if (cursor != null) { - mCursor = cursor; - cursor.registerContentObserver(mChangeObserver); - cursor.registerDataSetObserver(mDataSetObserver); - mRowIdColumnIndex = cursor.getColumnIndexOrThrow("_id"); - } - } } diff --git a/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java b/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java index 71554d6e1..3f66d5848 100644 --- a/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java @@ -129,7 +129,14 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2