diff options
author | Andrew Lee <anwlee@google.com> | 2015-06-09 14:29:05 -0700 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2015-06-09 14:38:26 -0700 |
commit | 427566a204903098de1b7866d25f711918bb28d9 (patch) | |
tree | f3f308abc2f32e2071a94f12ac909650a21c493d /tests/src | |
parent | 6a86690a2ad8f6c5068d901e6cbc368598e13ddc (diff) |
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
Diffstat (limited to 'tests/src')
-rw-r--r-- | tests/src/com/android/dialer/calllog/CallLogFragmentTest.java | 10 |
1 files changed, 8 insertions, 2 deletions
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<Fragme mAdapter.pauseCache(); mParentView = new FrameLayout(mActivity); mCursor = new MatrixCursor(CallLogQuery._PROJECTION); - mAdapter.setCursorForTesting(mCursor); + + getInstrumentation().runOnMainSync(new Runnable() { + @Override + public void run() { + mAdapter.changeCursor(mCursor); + } + }); + getInstrumentation().waitForIdleSync(); } /** @@ -316,7 +323,6 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme public void testBindView_CallButton() { mCursor.moveToFirst(); insert(TEST_NUMBER, Calls.PRESENTATION_ALLOWED, NOW, 0, Calls.INCOMING_TYPE); - mAdapter.changeCursor(mCursor); CallLogListItemViewHolder viewHolder = (CallLogListItemViewHolder) mAdapter.onCreateViewHolder(mParentView, /* viewType */ 0); bindViewForTest(viewHolder); |